{"record":{"id":"99c8023e8e92e093","repo":"jdx/mise","slug":"a-provided-source-resolves-to-a-path","errorCode":null,"errorMessage":"a provided source resolves to a path","messagePattern":"a provided source resolves to a path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote.rs","lineNumber":172,"sourceCode":"    let mut hosts = IndexMap::new();\n    for cf in config.config_files.values() {\n        let Some(bootstrap) = cf.bootstrap_config() else {\n            continue;\n        };\n        let remote = bootstrap.remote;\n        let base = cf.get_path().parent().unwrap_or_else(|| Path::new(\".\"));\n        let default_source = resolve_local_path(base, remote.source.as_deref())?;\n        let default_mise_env = remote.mise_env;\n        let default_install_mise = remote.install_mise.and_then(InstallMiseTomlConfig::path);\n        let default_copy_links = remote.copy_links;\n        let default_copy_link = remote.copy_link;\n        for (name, host) in remote.hosts {\n            if hosts.contains_key(&name) {\n                continue;\n            }\n            let source = match host.source.as_deref() {\n                Some(source) => resolve_local_path(base, Some(source))?\n                    .expect(\"a provided source resolves to a path\"),\n                None => default_source.clone().unwrap_or(std::env::current_dir()?),\n            };\n            let identity_file = resolve_local_path(base, host.identity_file.as_deref())?;\n            let mise_bin = resolve_local_path(base, host.mise_bin.as_deref())?;\n            let mut exclude = default_excludes();\n            exclude.extend_from_slice(layered_excludes);\n            exclude.extend(host.exclude);\n            let mut copy_link = default_copy_link.clone();\n            copy_link.extend(host.copy_link);\n            let host = RemoteHost {\n                name: name.clone(),\n                host: host.host,\n                user: host.user,\n                port: host.port,\n                identity_file,\n                source,\n                mise_env: host\n                    .mise_env","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/remote.rs#L154-L190","documentation":"In `hosts_from_config`, a host's explicit `source` is resolved via `resolve_local_path(base, Some(source))?.expect(\"a provided source resolves to a path\")`. The resolver returns an Option because a missing source can fall back to a default; but when the user provided one, None is treated as impossible. The panic fires when a provided source still resolves to None — e.g. the source is empty or resolves to nothing path-like.","triggerScenarios":"Configuring a remote host with a `source` value that `resolve_local_path` cannot turn into a path (empty string, or input the resolver filters out) at src/system/remote.rs:172.","commonSituations":"`source = \"\"` in a remote host config entry; templated source that expands to empty; copy-pasting a URL or ssh-style source where a local path is required.","solutions":["Set a non-empty local filesystem path (absolute, or relative to the config base) in the host's `source` field","Remove the `source` key entirely to inherit `default_source`","Improve the code to return a real error naming the offending host/source instead of expect-ing"],"exampleFix":"// before\n[remote.hosts.build]\nsource = \"\"\n// after\n[remote.hosts.build]\nsource = \"~/project/build-host\"","handlingStrategy":"validation","validationCode":"if let Some(src) = &host.source {\n    if src.trim().is_empty() {\n        return Err(anyhow!(\"host '{name}' has an empty source\"));\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use absolute or base-relative local paths for host source","Never leave templated source values that expand to empty","Omit the source key entirely to use the default"],"tags":["panic","remote","config","path"],"backgroundTag":"invalid-config-value","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}