{"record":{"id":"074fb675352c9914","repo":"paperclipai/paperclip","slug":"workspace-ignore-scan-failed-directoryignore-reason","errorCode":null,"errorMessage":"Workspace ignore scan failed: ${directoryIgnore.reason}","messagePattern":"Workspace ignore scan failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapter-utils/src/sandbox-managed-runtime.ts","lineNumber":1151,"sourceCode":"\n  // The git enumeration (`git status --ignored`, the HEAD diffs, `ls-files`).\n  // It reads git's own bookkeeping to decide what to include/exclude, so it is\n  // usually fast, but on a large working tree the `--ignored` walk is not free.\n  const gitSnapshot = syncWorkspace\n    ? input.workspaceGitSnapshot !== undefined\n      ? input.workspaceGitSnapshot\n      : await runStepSpan(\"snapshot.git\", () =>\n          readGitWorkspaceSnapshot(input.workspaceLocalDir),\n        )\n    : null;\n  // A selected subfolder has no cloneable Git snapshot, but its parent\n  // repository's ignore rules still govern which files may leave the host.\n  // Use the same bounded, path-relative resolver as referenced project trees.\n  const directoryIgnore = syncWorkspace && !gitSnapshot\n    ? await resolveReferencedSourceIgnore(input.workspaceLocalDir)\n    : null;\n  if (directoryIgnore?.kind === \"failed\") {\n    throw new Error(`Workspace ignore scan failed: ${directoryIgnore.reason}`);\n  }\n  const gitIgnoredExcludes = gitSnapshot?.ignoredPaths\n    ?? (directoryIgnore?.kind === \"git\" ? directoryIgnore.ignoredPaths : undefined);\n  const workspaceArchiveExclude = mergeExcludes(\n    SANDBOX_WORKSPACE_HEAVY_DIR_EXCLUDES,\n    [...GIT_ARCHIVE_EXCLUDES],\n    input.workspaceExclude,\n    gitIgnoredExcludes,\n  );\n  const restoreExclude = mergeExcludes(\n    SANDBOX_WORKSPACE_HEAVY_DIR_EXCLUDES,\n    [...GIT_ARCHIVE_EXCLUDES],\n    [\".paperclip-runtime\"],\n    input.preserveAbsentOnRestore,\n    input.workspaceExclude,\n    gitIgnoredExcludes,\n  );\n  const repositories = gitSnapshot?.repositories ?? [];","sourceCodeStart":1133,"sourceCodeEnd":1169,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/packages/adapter-utils/src/sandbox-managed-runtime.ts#L1133-L1169","documentation":"Before archiving/syncing a workspace into the sandbox, the runtime resolves the workspace's effective ignore rules via resolveReferencedSourceIgnore. When that scan fails (kind === \"failed\"), the runtime cannot determine which files are allowed to leave the host, so it fails loudly instead of shipping a potentially wrong file set.","triggerScenarios":"syncWorkspace is true with no gitSnapshot, and resolveReferencedSourceIgnore(input.workspaceLocalDir) returns { kind: \"failed\", reason }.","commonSituations":"Workspace directory unreadable or deleted; git not installed or repo metadata corrupt so ignore resolution fails; symlinked/network-mounted workspace causing the scanner to error; permission problems on .gitignore traversal.","solutions":["Fix the underlying reason reported in the message (permissions, missing dir, broken git).","Ensure the workspaceLocalDir exists and is readable before starting the run.","If git-based ignore resolution fails, repair the repository (git status / reinstall git) or provide a valid gitSnapshot path.","Retry after resolving transient FS issues (network mounts, stale handles)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const scan = await resolveReferencedSourceIgnore(workspaceLocalDir);\nif (scan.kind === \"failed\") throw new Error(`workspace ignore scan failed: ${scan.reason}`);","typeGuard":"const ignoreScanOk = (r: IgnoreScanResult): r is Exclude<IgnoreScanResult, { kind: \"failed\" }> => r.kind !== \"failed\";","tryCatchPattern":"try { await startManagedRuntime(input); } catch (e) {\n  if (e.message.startsWith(\"Workspace ignore scan failed\")) { console.error(\"fix workspace/git:\", e.message); }\n  throw e;\n}","preventionTips":["Verify the workspace dir exists and is readable before starting a run","Keep git installed and the workspace a valid repo when using git ignore resolution","Avoid symlinked or network-mounted workspaces for sandbox sync","Log directoryIgnore.reason to fix the root cause quickly"],"tags":["workspace","ignore-rules","sync","filesystem"],"backgroundTag":"file-read-failed","analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}