{"record":{"id":"bb89491ed8975b9d","repo":"zed-industries/zed","slug":"could-not-detect-a-working-directory-set-eval-cli","errorCode":null,"errorMessage":"Could not detect a working directory; set EVAL_CLI_WORKDIR via --ae","messagePattern":"Could not detect a working directory; set EVAL_CLI_WORKDIR via --ae","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"warning","filePath":"crates/eval_cli/zed_eval/agent_common.py","lineNumber":96,"sourceCode":"            '| head -1 | sed \"s|/.git$||\"'\n        ),\n    )\n    workdir = (result.stdout or \"\").strip()\n    if workdir:\n        return workdir\n\n    result = await exec_as_agent(\n        environment,\n        command=(\n            \"for d in /app /testbed /repo /root /home; do \"\n            '  if [ -d \"$d\" ]; then echo \"$d\"; exit 0; fi; '\n            \"done; pwd\"\n        ),\n    )\n    workdir = (result.stdout or \"\").strip()\n    if workdir:\n        return workdir\n    raise RuntimeError(error_message)\n\n\ndef populate_context_from_result(logs_dir: Path, context: Any, logger: Any) -> None:\n    result_data = None\n    for json_file in logs_dir.rglob(\"result.json\"):\n        try:\n            result_data = json.loads(json_file.read_text())\n            break\n        except (json.JSONDecodeError, OSError):\n            continue\n\n    if result_data is None:\n        logger.warning(\"Could not find or parse result.json from eval-cli\")\n        return\n\n    if result_data.get(\"input_tokens\") is not None:\n        context.n_input_tokens = result_data[\"input_tokens\"]\n    if result_data.get(\"output_tokens\") is not None:","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/eval_cli/zed_eval/agent_common.py#L78-L114","documentation":"write_skill_to_disk found something at {skills_dir}/{name}, but it is not a directory — a stray regular file, symlink, or similar. The explicit branch exists because create_dir on the real fs would otherwise fail with a generic 'File exists' IO error that gives no recovery hint.","triggerScenarios":"fs.metadata(&skill_dir) returns Ok(Some(metadata)) with metadata.is_dir == false: a file named exactly like the intended skill directory was left in the skills folder.","commonSituations":"A user or script created a file with the same name (e.g. a note file 'my-skill'); a partially deleted skill left a file behind; sync tools (Dropbox/backup) wrote a placeholder file.","solutions":["Delete the stray file at the path printed in the message","Rename or move it aside if its contents matter, then retry","Or pick a different skill name that does not collide with the file"],"exampleFix":"# before (terminal)\nfile ~/.config/zed/skills/my-skill   # 'ASCII text', not a directory\n\n# after (terminal)\nrm ~/.config/zed/skills/my-skill      # or: mv ... my-skill.txt.bak\n# then retry the import","handlingStrategy":"validation","validationCode":"// Distinguish 'directory exists' from 'stray file exists' before writing:\nmatch fs.metadata(&skills_dir.join(name)).await.ok().flatten() {\n    Some(m) if m.is_dir => show_hint(\"name taken by existing skill\"),\n    Some(_) => show_hint(\"a file occupies that path — delete or rename it\"),\n    None => {} // safe to write\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check both is_dir and existence so the user gets a targeted recovery hint before the write","Keep the skills directory hand-managed only through the UI to avoid stray files"],"tags":["skill-import","filesystem","path-conflict"],"backgroundTag":"file-exists-at-path","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}