{"record":{"id":"74ad39986eae7708","repo":"herdrdev/herdr","slug":"remote-binary-env-var-path-is-not-a-file","errorCode":null,"errorMessage":"{REMOTE_BINARY_ENV_VAR} path is not a file: {}","messagePattern":"(.+?) path is not a file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/remote/attach.rs","lineNumber":914,"sourceCode":"    if value.is_empty() {\n        return Err(io::Error::new(\n            io::ErrorKind::InvalidInput,\n            format!(\"{REMOTE_BINARY_ENV_VAR} must not be empty\"),\n        ));\n    }\n\n    let path = PathBuf::from(value);\n    let metadata = fs::metadata(&path).map_err(|err| {\n        io::Error::new(\n            err.kind(),\n            format!(\n                \"failed to inspect {REMOTE_BINARY_ENV_VAR} path {}: {err}\",\n                path.display()\n            ),\n        )\n    })?;\n    if !metadata.is_file() {\n        return Err(io::Error::new(\n            io::ErrorKind::InvalidInput,\n            format!(\n                \"{REMOTE_BINARY_ENV_VAR} path is not a file: {}\",\n                path.display()\n            ),\n        ));\n    }\n\n    Ok(Some(path))\n}\n\nfn install_source_description(platform: &RemotePlatform, override_binary: Option<&Path>) -> String {\n    install_source_description_for(\n        platform,\n        override_binary,\n        local_binary_can_seed_remote(platform),\n    )\n}","sourceCodeStart":896,"sourceCodeEnd":932,"githubUrl":"https://github.com/herdrdev/herdr/blob/f457cff4f2648eee85d176f8a41861241d4e8428/src/remote/attach.rs#L896-L932","documentation":"After successfully statting the HERDR_REMOTE_BINARY path, herdr checks that it is a regular file. This error means the metadata shows the path is a directory, socket, device, or other non-file entity, so it cannot be executed as the remote binary.","triggerScenarios":"Setting HERDR_REMOTE_BINARY to a directory (e.g. the bin directory instead of the binary itself), a FIFO, or a device node like /dev/null.","commonSituations":"User points the env var at the install directory (\"/usr/local/bin\" instead of \"/usr/local/bin/herdr\") or at a symlinked wrapper directory.","solutions":["Set HERDR_REMOTE_BINARY to the full path of the herdr executable file, not its directory","Confirm with: file \"$HERDR_REMOTE_BINARY\" showing a regular executable","Unset the variable to fall back to automatic resolution"],"exampleFix":"# before\nexport HERDR_REMOTE_BINARY=/usr/local/bin\n# after\nexport HERDR_REMOTE_BINARY=/usr/local/bin/herdr","handlingStrategy":"validation","validationCode":"let p = std::env::var(\"HERDR_REMOTE_BINARY\")?;\nlet meta = std::fs::metadata(&p)?;\nif !meta.is_file() {\n    eprintln!(\"{p} is not a regular file; fix HERDR_REMOTE_BINARY\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never point env vars at directories; validate with 'file' before export","Document the expected value as a full executable path"],"tags":["environment-variable","validation","remote-attach","rust"],"backgroundTag":"invalid-env-var-path","analyzedSha":"f457cff4f2648eee85d176f8a41861241d4e8428","analyzedAt":"2026-08-28T15:41:09.197Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}