{"record":{"id":"3f0991a5cb3bef0b","repo":"Hmbown/CodeWhale","slug":"is-not-a-regular-file","errorCode":null,"errorMessage":"{} is not a regular file","messagePattern":"(.+?) is not a regular file","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":2942,"sourceCode":"        }\n        if ch == '#' && !double_quoted {\n            comment = true;\n            continue;\n        }\n        if ch == '$' {\n            return true;\n        }\n    }\n    false\n}\n\nfn read_stable_workspace_dotenv(path: &Path) -> Result<Vec<u8>> {\n    let mut file = open_workspace_dotenv_without_following_links(path)?;\n    let metadata = file\n        .metadata()\n        .map_err(|error| anyhow!(\"could not inspect {}: {error}\", path.display()))?;\n    if !metadata.is_file() {\n        bail!(\"{} is not a regular file\", path.display());\n    }\n    if workspace_dotenv_has_multiple_links(&file, &metadata)? {\n        bail!(\n            \"{} has multiple filesystem links, not a unique workspace-owned file\",\n            path.display()\n        );\n    }\n    if metadata.len() > MAX_WORKSPACE_DOTENV_BYTES {\n        bail!(\n            \"{} exceeds the {} byte workspace .env limit\",\n            path.display(),\n            MAX_WORKSPACE_DOTENV_BYTES\n        );\n    }\n\n    let mut contents = Vec::with_capacity(metadata.len() as usize);\n    (&mut file)\n        .take(MAX_WORKSPACE_DOTENV_BYTES + 1)","sourceCodeStart":2924,"sourceCodeEnd":2960,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L2924-L2960","documentation":"read_stable_workspace_dotenv opens the workspace .env without following symlinks and inspects its metadata; if the opened path is not a regular file (e.g. a directory, device, FIFO, or socket), it bails. This guard ensures credentials are only read from a plain, workspace-owned file.","triggerScenarios":"A path named `.env` in the workspace that is actually a directory, named pipe, device node, or other non-regular filesystem object when Codewhale loads workspace dotenv credentials.","commonSituations":"A .env directory created by mistake (e.g. `mkdir .env`), a FIFO left by a script, or a devcontainer mount that presents .env as something other than a regular file.","solutions":["Check what `.env` is (`ls -la .env`, `stat .env`); if it is a directory, remove or rename it.","Create a real regular file: `touch .env` and put literal values in it.","Stop any process holding a FIFO/socket named .env in the workspace.","If a mount or volume is substituting .env, fix the mount so a regular file is presented."],"exampleFix":"// shell before\nmkdir .env   # accidentally created a directory\n// after\nrm -rf .env && touch .env && echo 'API_KEY=...' > .env","handlingStrategy":"validation","validationCode":"// shell\n[ -f .env ] && [ ! -L .env ] || { echo '.env must be a regular file'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check `stat .env` before launch; it must report a regular file.","Avoid creating .env as a directory or FIFO in workspace scaffolding scripts.","Fix container mounts so .env is projected as a plain file."],"tags":["dotenv","filesystem","validation","config"],"backgroundTag":"invalid-argument-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"}