{"record":{"id":"bc132ab03fcc9ebf","repo":"jdx/mise","slug":"backends-must-not-be-empty","errorCode":null,"errorMessage":"backends must not be empty","messagePattern":"backends must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/registry.rs","lineNumber":418,"sourceCode":"        for alias in tool.aliases {\n            entries.insert((*alias).to_string(), tool.clone());\n        }\n    }\n    Ok(Registry::dynamic(entries, missing_version_order))\n}\n\nfn parse_registry_tool(short: &str, value: &toml::Value) -> Result<(RegistryTool, bool)> {\n    let table = value\n        .as_table()\n        .ok_or_else(|| eyre::eyre!(\"registry tool must be a TOML table\"))?;\n    let backends = table\n        .get(\"backends\")\n        .and_then(toml::Value::as_array)\n        .ok_or_else(|| eyre::eyre!(\"backends must be an array\"))?\n        .iter()\n        .map(parse_registry_backend)\n        .collect::<Result<Vec<_>>>()?;\n    ensure!(!backends.is_empty(), \"backends must not be empty\");\n\n    let missing_version_order = !table.contains_key(\"version_order\");\n    let version_order = match table.get(\"version_order\").and_then(toml::Value::as_str) {\n        Some(\"source\") => VersionOrder::Source,\n        Some(\"semver\") => VersionOrder::Semver,\n        Some(_) => bail!(\"version_order must be \\\"source\\\" or \\\"semver\\\"\"),\n        None => VersionOrder::Source,\n    };\n\n    ensure!(\n        version_order == VersionOrder::Semver || backends.iter().all(|b| b.min_version.is_none()),\n        \"backend min_version requires version_order = \\\"semver\\\"\"\n    );\n    let aliases = string_array(table.get(\"aliases\"), \"aliases\")?;\n    let bins = if table.contains_key(\"bins\") {\n        string_array(table.get(\"bins\"), \"bins\")?\n    } else {\n        BAKED_REGISTRY","sourceCodeStart":400,"sourceCodeEnd":436,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/registry.rs#L400-L436","documentation":"When parsing a registry tool's TOML table, mise reads the `backends` key, which must be an array of backend definitions, and requires at least one entry. A registry tool with no backends cannot be installed by any means, so the registry source is considered invalid and rejected at parse time.","triggerScenarios":"parse_registry_tool encountering a `[tool]` table where `backends` is an empty array (or `backends` is not an array at all, which raises the adjacent 'backends must be an array' error).","commonSituations":"A registry contributor adds a new tool stub with `backends = []` as a placeholder, a template removal left the array empty, or a bad merge dropped all backend entries from the tool's TOML file.","solutions":["Add at least one backend to the tool's registry TOML, e.g. `[[backends]]` with a valid backend type and source (aqua:/github:/http: etc.).","Check the tool's TOML for `backends = []` and restore the backend entries that were removed or lost in a merge.","Validate the registry TOML locally before publishing (mise's registry test path will surface this error)."],"exampleFix":"// before (registry TOML)\n[node]\ndescription = \"Node.js\"\nbackends = []\n\n// after\n[node]\ndescription = \"Node.js\"\n\n[[backends]]\ntype = \"aqua\"\nsource = \"nodejs/node\"","handlingStrategy":"validation","validationCode":"// quick TOML sanity check in Rust before handing a table to registry parsing\nlet backends = table.get(\"backends\").and_then(toml::Value::as_array)\n    .ok_or(\"tool TOML missing 'backends' array\")?;\nif backends.is_empty() { return Err(\"tool has no backends\".into()); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never commit tool TOMLs with `backends = []`; treat it as a broken stub.","Run registry validation in CI to catch empty backend arrays before merge.","Review merges that touch registry TOMLs for accidentally dropped [[backends]] blocks."],"tags":["registry","toml","validation","empty-array"],"backgroundTag":"empty-required-field","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}