{"record":{"id":"66efc061a2ef4f4d","repo":"BloopAI/vibe-kanban","slug":"failed-to-run-setup-script","errorCode":null,"errorMessage":"Failed to run setup script","messagePattern":"Failed to run setup script","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/web-core/src/shared/actions/index.ts","lineNumber":1172,"sourceCode":"  // === Script Actions ===\n  RunSetupScript: {\n    id: 'run-setup-script',\n    label: 'Run Setup Script',\n    icon: TerminalIcon,\n    shortcut: 'R S',\n    requiresTarget: ActionTargetType.WORKSPACE,\n    isVisible: (ctx) => ctx.hasWorkspace,\n    isEnabled: (ctx) => !ctx.isAttemptRunning,\n    execute: async (_ctx, workspaceId) => {\n      const result = await workspacesApi.runSetupScript(workspaceId);\n      if (!result.success) {\n        if (result.error?.type === 'no_script_configured') {\n          throw new Error('No setup 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 setup script');\n      }\n    },\n  },\n\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        }","sourceCodeStart":1154,"sourceCodeEnd":1190,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/packages/web-core/src/shared/actions/index.ts#L1154-L1190","documentation":"The fallback error of the RunSetupScript action: thrown when runSetupScript returns success:false but the error type is neither 'no_script_configured' nor 'process_already_running', i.e. an unexpected server-side failure while launching the setup script.","triggerScenarios":"workspacesApi.runSetupScript resolving with { success: false, error: { type: <other> } } — e.g. executor spawn failure, workspace not found, filesystem/exec errors, or a backend that failed to start the script process for an unclassified reason.","commonSituations":"Setup script exiting immediately with a bad exit code, executor binary missing or crashing, insufficient permissions to run the script file, or the workspace/attempt having been deleted before the request reached the executor.","solutions":["Check the backend logs for the underlying execution error logged at the moment of the failure.","Verify the script itself runs locally (correct shebang, executable bit, exit code 0).","Confirm the workspace and attempt still exist and the executor service is healthy.","Extend frontend handling to surface result.error.type/message instead of the generic message for better diagnosis."],"exampleFix":"// before\nthrow new Error('Failed to run setup script');\n// after\nthrow new Error(`Failed to run setup script: ${result.error?.message ?? 'unknown error'}`);","handlingStrategy":"try-catch","validationCode":"// before running\nif (!ctx.hasWorkspace) throw new Error('Workspace not available');\nif (!ctx.project.setupScript) 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.runSetupScript(workspaceId);\n  if (!result.success) {\n    throw new Error(`Setup script failed (${result.error?.type ?? 'unknown'}): ${result.error?.message ?? ''}`);\n  }\n} catch (err) {\n  toast.error(String(err));\n  // show backend execution logs to the user for diagnosis\n}","preventionTips":["Test the setup script manually to ensure it exits 0.","Check executor/backend logs immediately after a failure.","Keep executor binaries and permissions correct on the host machine.","Carry result.error details into user-facing 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"}