{"record":{"id":"950460767c4cf143","repo":"NousResearch/hermes-agent","slug":"format-runtime-provider-error-exc","errorCode":null,"errorMessage":"{format_runtime_provider_error(exc)}","messagePattern":"\\{format_runtime_provider_error\\(exc\\)\\}","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"gateway/platforms/api_server.py","lineNumber":341,"sourceCode":"        if value is None:\n            continue\n        runtime_kwargs[key] = list(value) if key == \"args\" and isinstance(value, (list, tuple)) else value\n    return runtime_kwargs\n\n\ndef _resolve_request_runtime_agent_kwargs(provider: str, target_model: Optional[str] = None) -> Dict[str, Any]:\n    \"\"\"Resolve runtime kwargs for a one-request provider override.\n\n    This mirrors gateway.run._resolve_runtime_agent_kwargs(), but accepts an\n    explicit provider/model so an API caller can use the same authenticated\n    provider catalog as the TUI without mutating config.yaml.\n    \"\"\"\n    from hermes_cli.runtime_provider import resolve_runtime_provider, format_runtime_provider_error, _get_model_config\n\n    try:\n        runtime = resolve_runtime_provider(requested=provider, target_model=target_model)\n    except Exception as exc:\n        raise RuntimeError(format_runtime_provider_error(exc)) from exc\n\n    model_cfg = _get_model_config()\n    max_tokens = None\n    env_max_tokens = os.environ.get(\"HERMES_MAX_TOKENS\")\n    if env_max_tokens:\n        try:\n            max_tokens = int(env_max_tokens)\n        except (ValueError, TypeError):\n            max_tokens = None\n    elif isinstance(model_cfg, dict):\n        cfg_max_tokens = model_cfg.get(\"max_tokens\")\n        if isinstance(cfg_max_tokens, int):\n            max_tokens = cfg_max_tokens\n    if max_tokens is None:\n        runtime_max_tokens = runtime.get(\"max_output_tokens\")\n        if isinstance(runtime_max_tokens, int) and runtime_max_tokens > 0:\n            max_tokens = runtime_max_tokens\n","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/gateway/platforms/api_server.py#L323-L359","documentation":"Error \"{format_runtime_provider_error(exc)}\" thrown in NousResearch/hermes-agent.","triggerScenarios":"Thrown at gateway/platforms/api_server.py:341 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the provider/auth error shown (API key, model, base URL) and retry the request.","Run `hermes setup` or `hermes model` to repair the provider configuration."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}