zed-industries/zed · warning · RuntimeError

Could not detect a working directory; set EVAL_CLI_WORKDIR v

Error message

Could not detect a working directory; set EVAL_CLI_WORKDIR via --ae

What it means

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.

Source

Thrown at crates/eval_cli/zed_eval/agent_common.py:96

            '| head -1 | sed "s|/.git$||"'
        ),
    )
    workdir = (result.stdout or "").strip()
    if workdir:
        return workdir

    result = await exec_as_agent(
        environment,
        command=(
            "for d in /app /testbed /repo /root /home; do "
            '  if [ -d "$d" ]; then echo "$d"; exit 0; fi; '
            "done; pwd"
        ),
    )
    workdir = (result.stdout or "").strip()
    if workdir:
        return workdir
    raise RuntimeError(error_message)


def populate_context_from_result(logs_dir: Path, context: Any, logger: Any) -> None:
    result_data = None
    for json_file in logs_dir.rglob("result.json"):
        try:
            result_data = json.loads(json_file.read_text())
            break
        except (json.JSONDecodeError, OSError):
            continue

    if result_data is None:
        logger.warning("Could not find or parse result.json from eval-cli")
        return

    if result_data.get("input_tokens") is not None:
        context.n_input_tokens = result_data["input_tokens"]
    if result_data.get("output_tokens") is not None:

View on GitHub (pinned to f4178619ac)

Solutions

  1. Delete the stray file at the path printed in the message
  2. Rename or move it aside if its contents matter, then retry
  3. Or pick a different skill name that does not collide with the file

Example fix

# before (terminal)
file ~/.config/zed/skills/my-skill   # 'ASCII text', not a directory

# after (terminal)
rm ~/.config/zed/skills/my-skill      # or: mv ... my-skill.txt.bak
# then retry the import
Defensive patterns

Strategy: validation

Validate before calling

// Distinguish 'directory exists' from 'stray file exists' before writing:
match fs.metadata(&skills_dir.join(name)).await.ok().flatten() {
    Some(m) if m.is_dir => show_hint("name taken by existing skill"),
    Some(_) => show_hint("a file occupies that path — delete or rename it"),
    None => {} // safe to write
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/bb89491ed8975b9d. Report an issue: GitHub.