{"record":{"id":"ea39552d7523ffe1","repo":"sinelaw/fresh","slug":"project-path-does-not-exist-requestedpath","errorCode":null,"errorMessage":"project path does not exist: ${requestedPath}","messagePattern":"project path does not exist: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/fresh-editor/plugins/orchestrator.ts","lineNumber":10430,"sourceCode":"      cmd,\n      remotePath: trimmed(options.path),\n      identity: trimmed(options.identity),\n      extraArgs,\n    });\n    // The dialog keeps itself open on a bad host and shows the message; a\n    // caller gets the same message as a thrown error.\n    if (!built.ok) throw new Error(built.error);\n    return built.spec;\n  }\n\n  const requestedPath = trimmed(options.path);\n  const projectPath = requestedPath || localProjectDefault();\n  // A path the caller passed has to exist. The dialog's field completes against\n  // the filesystem, so a human sees a wrong path immediately; a caller passing\n  // `path` by hand does not, and the create would otherwise \"succeed\" into a\n  // workspace rooted at a directory that isn't there.\n  if (requestedPath && !editor.fileExists(editor.localPath(requestedPath))) {\n    throw new Error(`project path does not exist: ${requestedPath}`);\n  }\n  return buildLocalSpec({\n    ...agentOptions,\n    projectPath,\n    // \"\" ⇒ `runLocalCreate` allocates the next `<project>-N` name, the same\n    // default the dialog's placeholder shows.\n    name,\n    cmd,\n    branch: trimmed(options.branch),\n    newBranch: trimmed(options.newBranch),\n    // Worktree by default (the dialog's default too); `runLocalCreate` demotes\n    // it to false on its own when the path isn't a git tree.\n    createWorktree: options.worktree ?? true,\n  });\n}\n\nasync function newWorkspace(\n  options: NewWorkspaceOptions = {},","sourceCodeStart":10412,"sourceCodeEnd":10448,"githubUrl":"https://github.com/sinelaw/fresh/blob/67894ca5463dbd7a89bb31add4627c27d6b79d83/crates/fresh-editor/plugins/orchestrator.ts#L10412-L10448","documentation":"The orchestrator's local create path verifies that a caller-supplied `path` exists on the local filesystem via editor.fileExists(editor.localPath(requestedPath)) before building the spec. If the path is missing, it throws. The comment explains why: the interactive dialog autocompletes against the filesystem so a human sees a bad path immediately, but a hand-written caller would otherwise 'succeed' into a workspace rooted at a nonexistent directory.","triggerScenarios":"Calling the local create/run API with `options.path` set to a directory that does not exist on disk (typo, unmounted volume, path on a different machine, or relative path resolved against the wrong base).","commonSituations":"Automation scripts hardcoding paths that exist only on the author's machine; CI runners where the repo hasn't been checked out yet; typos or trailing hostname prefixes left in from a remote-create style path; case-sensitivity mismatches on Linux.","solutions":["Check the path exists before calling: `fs.existsSync(requestedPath)` or create it first with mkdir -p.","Correct typos in the configured project path in your script or config.","If the path was copied from a remote-create call, strip any host prefix and use a local absolute path.","Omit `path` entirely to fall back to localProjectDefault() instead of passing a bad path."],"exampleFix":"// before\nawait orchestrator.createLocal({ path: \"/home/me/projeckt\" });\n// after\nconst p = \"/home/me/project\";\nif (!require(\"fs\").existsSync(p)) throw new Error(`fix path: ${p}`);\nawait orchestrator.createLocal({ path: p });","handlingStrategy":"validation","validationCode":"import { existsSync } from \"fs\";\nconst p = options.path;\nif (p && !existsSync(p)) throw new Error(`project path does not exist: ${p}`);\n// or omit path to use localProjectDefault()","typeGuard":"function isExistingDir(p) { return typeof p === \"string\" && p.length > 0 && existsSync(p); }","tryCatchPattern":"try {\n  const ws = await orchestrator.createLocal({ path: requestedPath });\n} catch (e) {\n  if (/project path does not exist/.test(String(e))) {\n    const corrected = await promptForPath();\n    ws = await orchestrator.createLocal({ path: corrected });\n  } else { throw e; }\n}","preventionTips":["existsSync() every scripted path before passing it as options.path.","Use absolute paths; relative paths resolve against an environment-dependent cwd.","In CI, check out the repository before creating a workspace rooted at it.","Omit `path` and rely on localProjectDefault() when no specific directory is needed."],"tags":["filesystem","path","validation","workspace"],"backgroundTag":"directory-not-found","analyzedSha":"67894ca5463dbd7a89bb31add4627c27d6b79d83","analyzedAt":"2026-09-13T15:04:03.701Z","contentChangedAt":"2026-09-13T15:04:03.701Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}