{"record":{"id":"fb13acb3cd28b432","repo":"Hmbown/CodeWhale","slug":"unknown-field-field-key-for-custom-provider-provider-id","errorCode":null,"errorMessage":"unknown field '{field_key}' for custom provider '{provider_id}': expected one of {CUSTOM_PROVIDER_FIELD_HINT}","messagePattern":"unknown field '(.+?)' for custom provider '(.+?)': expected one of (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/config/src/lib.rs","lineNumber":2593,"sourceCode":"                 insecure_skip_tls_verify, http_headers, path_suffix\"\n            );\n        }\n        if field_key == \"kind\" {\n            let compatible =\n                value.trim().to_ascii_lowercase().replace('_', \"-\") == \"openai-compatible\";\n            if !compatible {\n                bail!(\n                    \"custom provider '{provider_id}' must set [providers.{provider_id}].kind = \\\"openai-compatible\\\"\"\n                );\n            }\n            self.custom_provider_table_mut(provider_id)?.insert(\n                \"kind\".to_string(),\n                toml::Value::String(value.trim().to_string()),\n            );\n            return Ok(());\n        }\n        let Some(field) = ProviderConfigField::parse(field_key) else {\n            bail!(\n                \"unknown field '{field_key}' for custom provider '{provider_id}': \\\n                 expected one of {CUSTOM_PROVIDER_FIELD_HINT}\"\n            );\n        };\n        let toml_value = match field {\n            ProviderConfigField::Vendor => {\n                bail!(\"vendor is only supported by providers.openrouter\")\n            }\n            ProviderConfigField::ApiKey\n            | ProviderConfigField::BaseUrl\n            | ProviderConfigField::Model\n            | ProviderConfigField::Mode\n            | ProviderConfigField::Wire\n            | ProviderConfigField::AuthMode\n            | ProviderConfigField::PathSuffix => toml::Value::String(value.to_string()),\n            ProviderConfigField::ContextWindow => {\n                toml::Value::Integer(i64::from(parse_context_window(value)?))\n            }","sourceCodeStart":2575,"sourceCodeEnd":2611,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/config/src/lib.rs#L2575-L2611","documentation":"For custom providers, any field key that does not parse into ProviderConfigField is rejected with the full list of accepted fields (CUSTOM_PROVIDER_FIELD_HINT). This is a fail-fast guard against typos and unsupported keys in [providers.<custom-id>] tables.","triggerScenarios":"set_custom_provider_value called with a field_key that is not \"kind\" and not in the hint list — e.g. misspelled `contextwindow`, `headers` instead of `http_headers`, or a field only valid for built-ins.","commonSituations":"Typing field names from memory in config.toml; scripting `config set providers.myapi.ky <value>`; assuming custom providers accept the same set as built-ins (e.g. auth_mode or insecure_skip_tls_verify) when the hint list differs.","solutions":["Use a field from CUSTOM_PROVIDER_FIELD_HINT (the message itself lists valid names)","Fix spelling/underscores (e.g. http_headers, base_url, context_window)","For unknown extras, check whether a newer version supports the field or use http_headers to pass HTTP-level configuration"],"exampleFix":"// before\ncodewhale config set providers.myapi.headers '{\"X-Org\":\"1\"}'\n// after\ncodewhale config set providers.myapi.http_headers '{\"X-Org\":\"1\"}'","handlingStrategy":"validation","validationCode":"let hint_fields = [\"api_key\",\"base_url\",\"model\",\"mode\",\"context_window\",\"http_headers\",\"path_suffix\",\"kind\"]; // per CUSTOM_PROVIDER_FIELD_HINT\nif !hint_fields.contains(&field_key) {\n    return Err(format!(\"unknown custom provider field {field_key}\"));\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"unknown field\") => eprintln!(\"{e}\"), // message lists valid fields\n    other => other?,\n}","preventionTips":["Echo the error's field hint back to the user","Generate config fields from the same enum the library uses","Use snake_case consistently in config generators"],"tags":["config","provider","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}