{"record":{"id":"43bdc43a9221f54b","repo":"aaif-goose/goose","slug":"provider-has-dynamic-models-false-but-no-sta-43bdc4","errorCode":null,"errorMessage":"Provider '{}' has dynamic_models: false but no static models listed; at least one entry in `models` is required.","messagePattern":"Provider '(.+?)' has dynamic_models: false but no static models listed; at least one entry in `models` is required\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/goose-providers/src/openai.rs","lineNumber":870,"sourceCode":"        if !is_reserved_request_param_key(key) {\n            object.insert(key.clone(), value.clone());\n        }\n    }\n}\n\npub fn from_declarative_config(\n    config: DeclarativeProviderConfig,\n    tls_config: Option<TlsConfig>,\n    key_resolver: impl KeyResolver,\n) -> Result<OpenAiProviderBuilder> {\n    let custom_models = if !config.models.is_empty() {\n        Some(config.models.clone())\n    } else {\n        None\n    };\n\n    if config.dynamic_models == Some(false) && custom_models.is_none() {\n        return Err(anyhow::anyhow!(\n            \"Provider '{}' has dynamic_models: false but no static models listed; \\\n             at least one entry in `models` is required.\",\n            config.name\n        ));\n    }\n\n    let api_key = if config.api_key_env.is_empty() {\n        None\n    } else {\n        match key_resolver.resolve_key(config.api_key_env.as_str()) {\n            Ok(key) => Some(key),\n            Err(err) => {\n                if config.requires_auth {\n                    anyhow::bail!(\"missing required key {}: {}\", config.api_key_env, err);\n                }\n                None\n            }\n        }","sourceCodeStart":852,"sourceCodeEnd":888,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-providers/src/openai.rs#L852-L888","documentation":"Thrown by OpenAiProviderBuilder::from_declarative_config when a declarative provider entry sets dynamic_models: false but its models list is empty. With dynamic model fetching disabled and no static entries, the provider has no way to know which models exist, so construction is rejected up front instead of failing later at request time.","triggerScenarios":"A YAML/JSON declarative provider config that contains 'dynamic_models: false' (or `dynamic_models: false` in frontmatter) while the 'models' key is absent, empty, or mis-indented so it parses as empty.","commonSituations":"Users pin static models to avoid network calls to a /models endpoint (offline, air-gapped, or rate-limited gateways) but forget to list the models; or a YAML indentation mistake puts the models entries under a different key so they are silently dropped.","solutions":["Add at least one model entry under 'models' for that provider, e.g. 'models: [{id: gpt-4o, context_limit: 128000}]'","If dynamic fetching should stay enabled, remove 'dynamic_models: false' or set it to true so the provider queries the /models endpoint","Check YAML indentation: 'models' must be a sibling of 'dynamic_models' under the same provider entry","Validate the resolved config (print the parsed DeclarativeProviderConfig) to confirm models is non-empty"],"exampleFix":"# before\nproviders:\n  my-gateway:\n    dynamic_models: false\n\n# after\nproviders:\n  my-gateway:\n    dynamic_models: false\n    models:\n      - id: my-model\n        context_limit: 128000","handlingStrategy":"validation","validationCode":"fn validate_provider(cfg: &DeclarativeProviderConfig) -> Result<(), String> {\n    if cfg.dynamic_models == Some(false) && cfg.models.is_empty() {\n        return Err(format!(\n            \"provider '{}' disables dynamic models but lists no models\",\n            cfg.name\n        ));\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = validate_provider(&cfg) {\n    eprintln!(\"config rejected: {e}\");\n    std::process::exit(2);\n}","preventionTips":["Lint declarative provider configs in CI: dynamic_models:false implies non-empty models","Keep model entries next to the dynamic_models key to spot mismatches"],"tags":["config","provider","models","validation"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}