{"record":{"id":"2240f4899b129e03","repo":"rust-lang/rust-analyzer","slug":"missing-entry-for-ty-default-field-field","errorCode":null,"errorMessage":"missing entry for {ty}: {default} (field {field})","messagePattern":"missing entry for (.+?): (.+?) \\(field (.+?)\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rust-analyzer/src/config.rs","lineNumber":4215,"sourceCode":"                            \"path\": {\n                                \"type\": \"string\",\n                            },\n                            \"type\": {\n                                \"type\": \"string\",\n                                \"enum\": [\"always\", \"methods\", \"sub_items\", \"variants\"],\n                                \"enumDescriptions\": [\n                                    \"Do not show this item or its methods (if it is a trait) in auto-import completions.\",\n                                    \"Do not show this trait's methods in auto-import completions.\",\n                                    \"Do not show this module's all items in it in auto-import completions.\",\n                                    \"Do not show this enum's variants in auto-import completions.\"\n                                ],\n                            },\n                        }\n                    }\n                ]\n             }\n        },\n        _ => panic!(\"missing entry for {ty}: {default} (field {field})\"),\n    }\n\n    map.into()\n}\n\nfn validate_toml_table(\n    known_ptrs: &[&[&'static str]],\n    toml: &toml::Table,\n    ptr: &mut String,\n    error_sink: &mut Vec<(String, toml::de::Error)>,\n) {\n    let verify = |ptr: &String| known_ptrs.iter().any(|ptrs| ptrs.contains(&ptr.as_str()));\n\n    let l = ptr.len();\n    for (k, v) in toml {\n        if !ptr.is_empty() {\n            ptr.push('_');\n        }","sourceCodeStart":4197,"sourceCodeEnd":4233,"githubUrl":"https://github.com/rust-lang/rust-analyzer/blob/e8f7e90aa3e7b26aa9a000200f606c1078da99ec/crates/rust-analyzer/src/config.rs#L4197-L4233","documentation":"This panic is thrown by the config TOML-to-JSON deserialization layer in rust-analyzer when it encounters a config entry type it does not know how to map into the config tree. The fallback match arm is intentionally unreachable: every supported config value type ('ty') should have a match arm that converts the default value for the given field. Hitting it means a new config type was added to the config schema without extending this match, so the generated/converted default map would be incomplete.","triggerScenarios":"Calling the config conversion function with a config field whose declared type (ty) has no arm in the match, e.g. after adding a new variant to the ConfigFlavor/type enum in config.rs but not updating the mapping code, or a mismatch between the declared type and the default value produced by the `set_roots`/default-generation path.","commonSituations":"Contributors adding a new rust-analyzer config option or a new config value type and forgetting to update the exhaustive match in the TOML table conversion; running `rust-analyzer --print-config` or workspace config loading right after such a change; codegen or manual edits drifting out of sync with the config schema.","solutions":["Add a match arm for the reported type/default combination in the conversion match in crates/rust-analyzer/src/config.rs","Regenerate or update any codegen-derived config schema so all types are covered (`cargo xtask codegen` if applicable)","Run `cargo test -p rust-analyzer` config tests to confirm the exhaustive match compiles and defaults map correctly"],"exampleFix":"// before\n        _ => panic!(\"missing entry for {ty}: {default} (field {field})\"),\n// after\n        (ty @ Flavor::MyNewType, ConfigValue::Bool(default)) => map.insert(field, ty_to_json(ty, *default)),\n        _ => panic!(\"missing entry for {ty}: {default} (field {field})\"),","handlingStrategy":"validation","validationCode":"// Before relying on converted defaults, assert all config types are covered:\nfn validate_config_coverage(entries: &[(Ty, Default)]) {\n    for (ty, default, field) in entries {\n        assert!(SUPPORTED_TYPES.contains(ty), \"unmapped config type {ty:?} for field {field}\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the type->default match exhaustive (no wildcard) so the compiler forces new arms","Add a config round-trip test (`--print-config`) executed when adding config options","Run `cargo xtask codegen` after schema changes"],"tags":["rust","config","panic","unreachable-match"],"backgroundTag":"unhandled-config-type","analyzedSha":"e8f7e90aa3e7b26aa9a000200f606c1078da99ec","analyzedAt":"2026-09-03T21:08:06.959Z","contentChangedAt":"2026-09-03T21:08:06.959Z","schemaVersion":2},"datasetVersion":"2026-09-11T07:07:21.782Z"}