deepseek-ai/deepseek-harness · error · FsError

FS_NOT_DIRECTORY

FS_NOT_DIRECTORY

Error message

cannot list "${target.displayPath}": not a directory

What it means

Type guard in listDir: the target exists but stat reports it is not a directory. Listing a regular file or special node cannot produce directory entries, so the adapter refuses with FsError rather than running the sandbox list command.

Solutions

  1. List an actual directory path
  2. Use readText/readBytes if the target is a file
  3. Fix path construction that dropped a directory component
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/e2b/fs-e2b/src/index.ts:349 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/1e9d7b78c20403de. Report an issue: GitHub.

Appendix: source

Thrown at packages/e2b/fs-e2b/src/index.ts:349

          throw mapError(error, 'read', displayPath, signal)
        } finally {
          if (!completed) {
            try {
              await reader.cancel()
            } catch (_streamCancellationFailure) {
              // The primary read outcome owns the result; cancellation is best-effort after early stop.
            }
          }
          reader.releaseLock()
        }
      },
    }
  }

  override async listDir(target: FsTarget, signal?: AbortSignal): Promise<FsDirEntry[]> {
    const info = await this.stat(target, signal)
    if (info === undefined) throw new FsError(`cannot list "${target.displayPath}": not found`, 'FS_NOT_FOUND')
    if (info.type !== 'directory') throw new FsError(`cannot list "${target.displayPath}": not a directory`, 'FS_NOT_DIRECTORY')
    try {
      const sandbox = await this.ctx.e2b.getSandbox()
      const listed = await sandbox.files.list(String(target.targetKey), { depth: 1, ...signalOpts(signal) })
      const entries: FsDirEntry[] = []
      for (const entry of listed) {
        const displayPath = posix.join(target.displayPath, entry.name)
        const canonical = entry.symlinkTarget === undefined
          ? entry.path
          : await this.canonicalPath(sandbox, entry.path, signal)
        const resolved = entry.symlinkTarget === undefined
          ? entry
          : await this.probe(canonical, displayPath, signal)
        entries.push({
          name: entry.name,
          type: resolved === undefined ? 'other' : entryType(resolved),
          target: { targetKey: FsTargetKey(canonical), displayPath },
          ...(resolved !== undefined ? { version: entryVersion(resolved) } : {}),
          ...(resolved?.type === FileType.FILE ? { size: resolved.size } : {}),

View on GitHub (pinned to b150a551b8)