{"record":{"id":"ea1ab421ce4bd9ad","repo":"BloopAI/vibe-kanban","slug":"failed-to-run-cleanup-script","errorCode":null,"errorMessage":"Failed to run cleanup script","messagePattern":"Failed to run cleanup script","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/web-core/src/shared/actions/index.ts","lineNumber":1194,"sourceCode":"\n  RunCleanupScript: {\n    id: 'run-cleanup-script',\n    label: 'Run Cleanup Script',\n    icon: TerminalIcon,\n    shortcut: 'R C',\n    requiresTarget: ActionTargetType.WORKSPACE,\n    isVisible: (ctx) => ctx.hasWorkspace,\n    isEnabled: (ctx) => !ctx.isAttemptRunning,\n    execute: async (_ctx, workspaceId) => {\n      const result = await workspacesApi.runCleanupScript(workspaceId);\n      if (!result.success) {\n        if (result.error?.type === 'no_script_configured') {\n          throw new Error('No cleanup script configured for this project');\n        }\n        if (result.error?.type === 'process_already_running') {\n          throw new Error('Cannot run script while another process is running');\n        }\n        throw new Error('Failed to run cleanup script');\n      }\n    },\n  },\n\n  RunArchiveScript: {\n    id: 'run-archive-script',\n    label: 'Run Archive Script',\n    icon: TerminalIcon,\n    shortcut: 'R A',\n    requiresTarget: ActionTargetType.WORKSPACE,\n    isVisible: (ctx) => ctx.hasWorkspace,\n    isEnabled: (ctx) => !ctx.isAttemptRunning,\n    execute: async (_ctx, workspaceId) => {\n      const result = await workspacesApi.runArchiveScript(workspaceId);\n      if (!result.success) {\n        if (result.error?.type === 'no_script_configured') {\n          throw new Error('No archive script configured for this project');\n        }","sourceCodeStart":1176,"sourceCodeEnd":1212,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/packages/web-core/src/shared/actions/index.ts#L1176-L1212","documentation":"The fallback error of the RunCleanupScript action: thrown when runCleanupScript returns success:false with an error type other than 'no_script_configured' or 'process_already_running', indicating an unexpected failure while starting the cleanup script.","triggerScenarios":"workspacesApi.runCleanupScript resolving with { success: false, error: { type: <other> } } — executor spawn failures, missing workspace, script exiting abnormally, or other unclassified backend errors.","commonSituations":"Cleanup script with wrong shebang or missing executable permission, executor service unhealthy, workspace/attempt deleted mid-request, or disk/permission problems on the machine running the script.","solutions":["Inspect backend logs for the concrete executor error behind the failure.","Run the cleanup script manually to verify it is executable and exits 0.","Verify the workspace and attempt still exist and the executor is running.","Include result.error details in the thrown message to aid future debugging."],"exampleFix":"// before\nthrow new Error('Failed to run cleanup script');\n// after\nthrow new Error(`Failed to run cleanup script: ${result.error?.message ?? 'unknown error'}`);","handlingStrategy":"try-catch","validationCode":"// before running\nif (!ctx.hasWorkspace) throw new Error('Workspace not available');\nif (!ctx.project.cleanupScript) return; // handled by the no_script_configured path","typeGuard":"function isScriptResult(res: unknown): res is { success: boolean; error?: { type: string; message?: string } } {\n  return typeof res === 'object' && res !== null && 'success' in res;\n}","tryCatchPattern":"try {\n  const result = await workspacesApi.runCleanupScript(workspaceId);\n  if (!result.success) {\n    throw new Error(`Cleanup script failed (${result.error?.type ?? 'unknown'}): ${result.error?.message ?? ''}`);\n  }\n} catch (err) {\n  toast.error(String(err));\n}","preventionTips":["Verify the cleanup script is executable and exits cleanly.","Review backend/executor logs after unexpected failures.","Ensure the workspace and attempt still exist before invoking.","Propagate result.error details into displayed messages."],"tags":["script","execution","workspace"],"backgroundTag":"script-execution-failed","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}