NVIDIA NeMo Guardrails Library Troubleshooting Guide
This page covers common issues you may encounter when configuring, running, or monitoring the NVIDIA NeMo Guardrails library, along with their resolution steps.
If your issue is not listed here, open an issue on GitHub.
Tutorial and Model Deployment
A Hosted NIM Returns an Authentication Error
For a 401 or 403 response, confirm that the key is available to the process running the library and has access to the requested service.
The built-in nim engine uses NVIDIA_API_KEY by default. If a model or rail specifies api_key_env_var, set the variable named in that configuration instead.
Restart a notebook kernel, server, or container after changing its environment.
Check the endpoint and model ID against the service’s current documentation. A hosted inference key and an NGC registry/model-download key serve different operations; use the permissions required for the operation that failed. For local NIM startup errors, inspect the container logs and verify the NGC key’s download permissions. See Installation and Model Configuration.
vLLM Does Not Start or the Model Is Not Ready
Inspect the vLLM startup log before sending requests from the library:
- For a CUDA out-of-memory error, check available GPU memory and other processes using the device. Reduce context length or concurrency, or use hardware that supports the selected model and serving configuration.
- For an import, driver, or CUDA error, use a separate serving environment and follow the vLLM GPU installation requirements. Match the vLLM, PyTorch, CUDA, and driver versions; do not assume that the library’s CPU installation requirements also cover the model server.
- For a model-download error, verify model access, any required license acceptance, network access, and available cache storage.
After startup completes, query the model server, using the host and port from your deployment:
Use the returned model ID and the server’s /v1 base URL in your model configuration.
With the default framework in 0.22 and later, use parameters.base_url; see Migrating to 0.22 for legacy parameter names.
A Safety Model Returns Unexpected Classifications
Confirm that the configuration selects the intended safety model, prompt template, output parser, and token limit.
Enable LLM call logging to inspect the rendered classification prompt and verdict. Keep these logs private when they contain user content.
An empty or truncated verdict may be treated as unsafe by the parser; raising the task’s max_tokens can help when the model needs more tokens to produce its final verdict.
Test labeled safe and unsafe cases, including benign requests that were incorrectly blocked. Compare the safety model’s direct response with the decision returned through the configured rail to distinguish model behavior from prompt or parser issues. See Evaluate Configuration and the Guardrail Catalog for the selected rail’s prompt and parser requirements.
A Response Contains Raw Reasoning Tags
A safety classifier may produce a reasoning trace wrapped in <think> tags before its verdict. That classifier output is separate from the assistant response returned to the user.
For the Nemotron Content Safety Reasoning 4B model, use nemotron_reasoning_parse_prompt_safety and nemotron_reasoning_parse_response_safety with the corresponding input and output tasks.
These parsers remove complete reasoning blocks before reading the safety verdict; the content safety flows produce the configured refusal when a check blocks.
If reasoning appears in user-visible content, inspect which model produced it and whether the application is returning classifier output or diagnostic logs as the assistant response. If the main model itself produces reasoning, check that model and provider’s response format separately. Report a reproducible case if reasoning still appears in the configured refusal. Disabling reasoning can help isolate the problem, but does not establish that the response-handling issue is fixed.
GLiNER Model Download Times Out
For the repository’s GLiNER reference server, model loading happens at startup. Inspect the server log for download, model-access, or storage errors, and confirm that the server can reach the model repository. Allow the initial download to complete before testing the rail, and preserve the model cache between restarts.
Query http://localhost:1235/health and confirm that status is healthy before sending extraction requests.
This reference server uses POST /v1/extract; a GLiNER NIM uses a different API. Match rails.config.gliner.server_endpoint to the server you deployed.
See GLiNER Integration for the two endpoint formats and local deployment instructions.
Runtime
Nested AsyncIO Loop
The NVIDIA NeMo Guardrails library is async-first. In notebooks, async web servers, and other environments that already run an event loop, use the async APIs:
Use check_async() for checks and generate_events_async() for Colang event generation.
The synchronous APIs remain supported outside a running event loop and do not require nest-asyncio.
Starting with 0.25, nest-asyncio is an optional dependency. By default, importing nemoguardrails does not import it or patch asyncio.
If you previously enabled automatic patching with DISABLE_NEST_ASYNCIO=false, install the compatibility extra:
Set the environment variable before importing nemoguardrails, then restart the Python process.
When enabled, the library imports nest_asyncio and applies its patch during package initialization.
This compatibility path emits a FutureWarning: automatic patching will be deprecated in 0.26. Migrate to the async APIs.
The optional compatibility path remains available in 0.26; its removal version will be announced separately.
To disable automatic patching, restore the default before importing the package:
Restart the Python process to discard any patch already applied.
LLMRailsRemovalWarning Says a Feature Will Be Removed
Your code constructs LLMRails, or runs a Colang 2.x configuration.
Both are deprecated in 0.25.0, and their removal is planned no earlier than 0.27.0.
The warning is a DeprecationWarning, names the feature at the start of the message, and points at the line in your code that triggered it.
nemoguardrails chat prints the Colang 2.x message to standard error instead.
Look up the message in Migrating to 0.25: Messages You Can Receive and apply the matching change. To hide the warning, or to turn it into an error in your tests, refer to Silence or Escalate the Warnings.
UserWarning Says IORails Ignores Part of the Configuration
Guardrails runs the configuration on the IORails engine, which ignores its Colang dialog flows, its custom refusal message, its config.py, or several of them.
The warning describes what the engine does today and carries no removal date.
For what to move where, refer to Migrating to 0.25: What IORails Ignores in a Configuration.
LLM Framework Routing
Starting with 0.22, two controls select whether an engine is handled by the built-in OpenAI-compatible client or by LangChain:
NEMOGUARDRAILS_LLM_FRAMEWORKenvironment variable. Read once at process startup. Default valuedefault(built-in). Set tolangchainto opt into the LangChain path, or to any name you register withregister_framework(name, instance)before initialization.nemoguardrails.set_default_framework(name). Switches the active selection at runtime. RaisesKeyErrorif the name is unknown and is not one of the lazy built-ins (default,langchain).
Use the environment variable when every model in a deployment uses the same path. Use set_default_framework from Python when you switch dynamically, such as in tests or when bootstrapping a custom framework.
For migration recipes, refer to Migrating to 0.22. For the engine-by-engine matrix, refer to Supported LLMs.
Error: No Default base_url for Provider
This error appears when the engine name you used (cohere in the example) is not a built-in OpenAI-compatible engine and you have not opted into LangChain.
The error itself names both fix paths; pick the one that matches your provider.
For migration recipes, refer to Migrating to 0.22.
Error: Framework Already Registered
register_framework does not allow rebinding.
If you see this error, the framework name is already registered in the current process.
Pick a different name. In tests, call the registry-reset hook before re-registering the same name.
Error: Unknown Framework
The set_default_framework call used a name that is not registered and is not one of the lazy built-ins default or langchain.
Register the framework first, or correct the name:
Error: Unsupported Parameter on First Call
Starting with 0.22, the built-in client forwards parameters from config.yml directly to the OpenAI-compatible HTTP request.
Keys that LangChain accepted as Python flags (streaming, disable_streaming, verbose, cache, callbacks, tags, metadata, name, model_kwargs) and provider-prefixed credential aliases (openai_api_base, nim_base_url, *_api_key, and others) are not part of the OpenAI wire shape, so the provider rejects them.
The library detects recognizable shapes at boot and on the first 400/422 response, and appends a migration hint to the underlying provider error.
Fix the configuration by choosing one path:
- Adapt the configuration to OpenAI-compatible shape. Rename
openai_api_basetobase_url, drop LangChain Python flags, and remove provider-prefixed aliases. The migration recipe in Migrating to 0.22 covers the common case. - Keep the 0.21 config. Set
NEMOGUARDRAILS_LLM_FRAMEWORK=langchainfor the process and install LangChain plus the matching upstream provider integration. The legacy field names continue to work when you opt into LangChain.
Guardrails Metrics
No Metrics Appear in Your Backend
Call set_meter_provider(...) before constructing Guardrails(config, use_iorails=True, require_iorails=True) (or LLMRails(config, require_iorails=True) when running with NEMO_GUARDRAILS_IORAILS_ENGINE=1).
Then verify that metrics.enabled: true is set in the configuration.
require_iorails=True makes the constructor raise if the config is incompatible with IORails, so metrics misconfiguration surfaces immediately rather than silently disabling metrics.
Metrics Are Silently Missing
When metrics.enabled: true but no MeterProvider is configured, the OpenTelemetry API returns a no-op meter and silently discards every emission.
The library does not log a warning.
Verify locally with ConsoleMetricExporter first.
Then ensure set_meter_provider(...) runs before constructing Guardrails(config, use_iorails=True, require_iorails=True) (or LLMRails(config, require_iorails=True) when running with NEMO_GUARDRAILS_IORAILS_ENGINE=1).
nemoguardrails server Exports No Metrics
The packaged server does not install a MeterProvider unless you ask it to.
Start it with --metrics-exporter prometheus (or set NEMO_GUARDRAILS_SERVER_METRICS_EXPORTER=prometheus) and scrape http://<host>:9464/metrics.
Only the guardrails.nonstream.* admission-queue metrics are exported through this path.
Refer to Prometheus and Grafana for the Guardrails Server.
Metrics Dependency Is Missing
If you see the following warning, the opentelemetry-api package is not installed:
Install the dependency:
Metrics Are Emitted but Never Reach the Backend
Verify that the exporter target is reachable.
Test with ConsoleMetricExporter first to confirm IORails engine emission, then swap in the production exporter.
LLMRails Produces No Metrics
Metrics are emitted only by the IORails engine.
Select IORails by setting NEMO_GUARDRAILS_IORAILS_ENGINE=1, which redirects LLMRails(config) to IORails, or by constructing Guardrails(config, use_iorails=True) directly.
Use generate_async(), stream_async(), or check_async() to emit metrics.
Pass require_iorails=True to raise when the configuration is incompatible with IORails instead of silently falling back to LLMRails, which emits no metrics.
Synchronous generate() or check() Produces No Metrics
Telemetry is disabled for the ephemeral engine constructed by the synchronous generate() and check() shims.
Use generate_async(), stream_async(), or check_async() for production paths.
gen_ai.client.token.usage Is Missing for Streaming Requests
The upstream provider did not return a usage field in the streamed response.
Forward stream_options={"include_usage": true} when calling OpenAI-compatible providers, or accept that token usage is not available for that provider.
Histogram Buckets Are Wrong in the Backend
The library sets bucket-boundary advisories per the OpenTelemetry spec.
Verify that your backend honors the SDK’s explicit_bucket_boundaries_advisory.
Some Prometheus exporters override the advisory unless explicitly configured.
guardrails.requests.active Drifts from the Sum of Saturation Gauges
A small steady drift is expected because the gauge reads are not atomic with the counter increments. A persistent large drift indicates an instrumentation bug. Open an issue.
Wrong service.name on Metrics
Set the Resource with service.name when constructing the MeterProvider.
Use the same Resource on the TracerProvider to keep traces and metrics correlated.