{"record":{"id":"5d9675b5c841bca5","repo":"pbakaus/impeccable","slug":"warning-cannot-access-target","errorCode":null,"errorMessage":"Warning: cannot access {target}\n","messagePattern":"Warning: cannot access (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/detect/src/cli.rs","lineNumber":702,"sourceCode":"                (None, None) => crate::engines::UrlEngine::detect_url(\n                    &crate::engines::MissingUrlEngine,\n                    target,\n                    &url_options,\n                ),\n            };\n            match result {\n                Ok(f) => all.extend(f),\n                Err(e) => {\n                    ctx.had_operational_failure = true;\n                    ctx.io.err(&format!(\"Error: {}\\n\", e.message));\n                }\n            }\n            continue;\n        }\n        let resolved = jsp::resolve(&ctx.cwd, &[target]);\n        let Ok(stat) = std::fs::metadata(&resolved) else {\n            ctx.had_operational_failure = true;\n            ctx.io.err(&format!(\"Warning: cannot access {target}\\n\"));\n            continue;\n        };\n        if stat.is_dir() {\n            if !ctx.json_mode && !ctx.quiet_mode {\n                if let Some(fw) = detect_framework_config(&resolved) {\n                    let probe = is_port_listening(fw.port, Some(fw.fingerprint));\n                    let msg = if probe.listening && probe.matched {\n                        format!(\n                            \"\\n{} dev server detected on localhost:{}.\\nFor more accurate results, scan the running site:\\n  npx impeccable detect http://localhost:{}\\n\\n\",\n                            fw.name, fw.port, fw.port\n                        )\n                    } else if probe.listening && !probe.matched {\n                        format!(\n                            \"\\n{} project detected ({}).\\nPort {} is in use by another service. Start the {} dev server and scan via URL for best results.\\n\\n\",\n                            fw.name,\n                            jsp::basename(&fw.config_path),\n                            fw.port,\n                            fw.name","sourceCodeStart":684,"sourceCodeEnd":720,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/detect/src/cli.rs#L684-L720","documentation":"When `impeccable detect` is given a local path target that is neither a URL nor resolvable on disk, scan_targets calls std::fs::metadata on the resolved path. If that fails (missing path, broken symlink, or permission error), it prints \"Warning: cannot access <target>\" to stderr, sets had_operational_failure (forcing a non-zero exit), and skips that target, continuing with any remaining targets.","triggerScenarios":"Running `impeccable detect <path>` where <path> (resolved against cwd via jsp::resolve) does not exist, is a broken symlink, or is not readable by the current user, and the target is not matched by URL_RE as a URL.","commonSituations":"Typos in a file/directory argument; running the scan from the wrong working directory so relative paths miss; deleting or renaming a folder between composing and running the command; scanning a mounted/removed volume; scanning a path the CI user cannot read due to permissions.","solutions":["Re-run `ls`/`test -e` on the exact path argument to confirm it exists relative to the current working directory","Run the command from the project root or pass an absolute path instead of a relative one","Check filesystem permissions on the path (read access for the invoking user)","If the target was meant to be a URL, pass a full http(s):// URL so it is routed to the URL engine instead of the filesystem"],"exampleFix":"// before\n$ impeccable detect ./srcc  # typo'd directory\nWarning: cannot access ./srcc\n\n// after\n$ ls ./src  # verify the path first\n$ impeccable detect ./src","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nfunction targetExists(target, cwd = process.cwd()) {\n  const resolved = require('path').resolve(cwd, target);\n  try { fs.accessSync(resolved, fs.constants.R_OK); return true; }\n  catch { return false; }\n}\nif (!targetExists('./src')) throw new Error('scan target missing or unreadable');","typeGuard":"function isAccessiblePath(p) {\n  try { return fs.statSync(p) !== undefined; } catch { return false; }\n}","tryCatchPattern":null,"preventionTips":["Test paths with `test -e`/`ls` before passing them to detect","Run the CLI from the project root or use absolute paths","Verify read permissions for the user running scans, especially in CI","Distinguish URL targets (http(s)://) from file paths explicitly in scripts"],"tags":["filesystem","path","cli"],"backgroundTag":"file-not-found","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}