BloopAI/vibe-kanban · error

Failed to run setup script

Error message

Failed to run setup script

What it means

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.

Source

Thrown at packages/web-core/src/shared/actions/index.ts:1172

  // === Script Actions ===
  RunSetupScript: {
    id: 'run-setup-script',
    label: 'Run Setup Script',
    icon: TerminalIcon,
    shortcut: 'R S',
    requiresTarget: ActionTargetType.WORKSPACE,
    isVisible: (ctx) => ctx.hasWorkspace,
    isEnabled: (ctx) => !ctx.isAttemptRunning,
    execute: async (_ctx, workspaceId) => {
      const result = await workspacesApi.runSetupScript(workspaceId);
      if (!result.success) {
        if (result.error?.type === 'no_script_configured') {
          throw new Error('No setup script configured for this project');
        }
        if (result.error?.type === 'process_already_running') {
          throw new Error('Cannot run script while another process is running');
        }
        throw new Error('Failed to run setup script');
      }
    },
  },

  RunCleanupScript: {
    id: 'run-cleanup-script',
    label: 'Run Cleanup Script',
    icon: TerminalIcon,
    shortcut: 'R C',
    requiresTarget: ActionTargetType.WORKSPACE,
    isVisible: (ctx) => ctx.hasWorkspace,
    isEnabled: (ctx) => !ctx.isAttemptRunning,
    execute: async (_ctx, workspaceId) => {
      const result = await workspacesApi.runCleanupScript(workspaceId);
      if (!result.success) {
        if (result.error?.type === 'no_script_configured') {
          throw new Error('No cleanup script configured for this project');
        }

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Check the backend logs for the underlying execution error logged at the moment of the failure.
  2. Verify the script itself runs locally (correct shebang, executable bit, exit code 0).
  3. Confirm the workspace and attempt still exist and the executor service is healthy.
  4. Extend frontend handling to surface result.error.type/message instead of the generic message for better diagnosis.

Example fix

// before
throw new Error('Failed to run setup script');
// after
throw new Error(`Failed to run setup script: ${result.error?.message ?? 'unknown error'}`);
Defensive patterns

Strategy: try-catch

Validate before calling

// before running
if (!ctx.hasWorkspace) throw new Error('Workspace not available');
if (!ctx.project.setupScript) return; // handled by the no_script_configured path

Type guard

function isScriptResult(res: unknown): res is { success: boolean; error?: { type: string; message?: string } } {
  return typeof res === 'object' && res !== null && 'success' in res;
}

Try / catch

try {
  const result = await workspacesApi.runSetupScript(workspaceId);
  if (!result.success) {
    throw new Error(`Setup script failed (${result.error?.type ?? 'unknown'}): ${result.error?.message ?? ''}`);
  }
} catch (err) {
  toast.error(String(err));
  // show backend execution logs to the user for diagnosis
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29). Data as JSON: /api/errors/66efc061a2ef4f4d. Report an issue: GitHub.