deepseek-ai/deepseek-harness · error · Error

cannot create a workspace at

Error message

cannot create a workspace at '${canonical}': path is not a directory

What it means

Thrown by workspace creation when the requested path exists on disk but is not a directory (for example a regular file or socket). The path is first canonicalized with fs.realpath — a nonexistent path rejects earlier with the original error — so reaching this guard means realpath succeeded and the canonical target exists but has the wrong filesystem type, making it impossible to own as a workspace root.

Solutions

  1. Create the workspace at an existing directory path, or create the directory first.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/workspace/workspace/src/index.ts:161 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/4a4b1a70663f0b1e. Report an issue: GitHub.

Appendix: source

Thrown at packages/workspace/workspace/src/index.ts:161

   * Create or reuse a workspace for an existing directory. The path is
   * canonicalized through `fs.realpath`; a nonexistent path rejects with the
   * original error and a non-directory rejects. Repeated calls for the same
   * canonical path return the existing entity without changing its title.
   * A newly created workspace is prepended to the durable registry order.
   * Different canonical paths may share a display title.
   * @param path - Existing directory to own, in any path spelling.
   * @param title - Display title used only when a new record is created.
   * @returns the existing or newly durable workspace.
   */
  // TODO: `title` lost its last production caller when the gateway's
  // create-by-name branch was deleted
  // (.agents/notes/implemented/simplification/2026-07-31-one-route-to-add-a-workspace.md);
  // drop the parameter with its @param clause and the `create(path, title?)`
  // lines in this package's README pair.
  async create(path: string, title?: string): Promise<Workspace> {
    const canonical = await realpathNormalize(path)
    if (!(await stat(canonical)).isDirectory()) {
      throw new Error(`cannot create a workspace at '${canonical}': path is not a directory`)
    }
    return await this.enqueueOperation(() => this.createCanonical(canonical, title))
  }

  /**
   * Look up a workspace by id.
   * @param id - Workspace id.
   * @returns the workspace, or `undefined` when unknown.
   */
  get(id: WorkspaceId): Workspace | undefined {
    return this.entities.get(id)
  }

  /**
   * Synchronous workspace projection in durable registry order. Every
   * entity's `sessionIds` getter is already filtered by the startup/live
   * canonical-cwd header index; this method performs no persistence reads.
   * @returns a fresh ordered array of workspace entities.

View on GitHub (pinned to b150a551b8)