Skip to content

[Bug]: App crashes | Claude API Key Disappears #520

@Igcorreia

Description

@Igcorreia

Operating System

Windows

Run Mode

Electron (Desktop App)

App Version

0.11.0

Bug Description

The app keeps crashing.

At first I thought I might be running a second project on port 3000 and that it was killing the API/server, but that doesn’t seem to be the case. When I start the Electron app, I immediately see the following errors:

ERROR [Server] ERROR [AutoMode] Failed to resume feature add-content-modal: Error: already running
at AutoModeService.resumeFeature (XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.ts:940:13)
at AutoModeService.resumeInterruptedFeatures (XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.ts:3517:22)
at async (src\routes\auto-mode\routes\resume-interrupted.ts:30:7)
ERROR [AutoMode] Failed to resume feature api-key-management-ui: Error: already running
at AutoModeService.resumeFeature (XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.ts:940:13)
at AutoModeService.resumeInterruptedFeatures (XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.ts:3517:22)
at async (src\routes\auto-mode\routes\resume-interrupted.ts:30:7)
ERROR [AutoMode] Failed to resume feature audit-log-viewer: Error: already running
at AutoModeService.resumeFeature (XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.ts:940:13)
at AutoModeService.resumeInterruptedFeatures (XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.ts:3517:22)
at async (src\routes\auto-mode\routes\resume-interrupted.ts:30:7)
INFO [Server] GET /api/running-agents 200

Two related observations:

The Claude API key disappears on restart. I have to re-add it every time.

There’s one specific idea/task that seems to trigger the crash. If I pause that item, everything works normally. As soon as I move it back to IN PROGRESS, the app crashes again.


IMPROVE BY AI:

Bug Report: App crashes when resuming AutoMode feature after moving task to IN PROGRESS

Summary

The Electron app crashes when a specific idea/task is moved to IN PROGRESS. The crash appears to be triggered during AutoMode’s attempt to resume previously interrupted features. Multiple features fail with an already running error, followed by a failure in a Claude-backed feature where the Claude Code subprocess exits with code 1. After the crash, the Claude API key is no longer persisted and must be re-added.


Expected Behavior

  • On app startup, AutoMode should safely resume interrupted features or skip those already running.
  • Moving an idea/task to IN PROGRESS should start or resume its associated feature without crashing the app.
  • The Claude API key should persist across restarts.
  • If a Claude subprocess fails, the error should be handled gracefully and the app should remain stable.


Relevant Logs (Sanitized)

  • AutoMode resume failures with Error: already running

  • Claude provider execution failure:

    • Claude Code process exited with code 1
  • AutoMode feature failure following the Claude subprocess exit


Hypotheses / Possible Root Causes

  1. Auto-resume race condition

    • AutoMode may be attempting to resume features that are already active, leading to duplicate execution attempts and inconsistent internal state.
  2. Claude subprocess lifecycle issue

    • The Claude Code process may be spawned multiple times or terminated unexpectedly when a feature is resumed, causing an unrecoverable exit (code 1) that propagates up and crashes the app.
  3. Corrupted or inconsistent persisted state

    • The persisted state for the problematic idea/task or AutoMode features may be corrupted, causing AutoMode to believe a feature is both “running” and “interrupted.”
    • This could also explain why the Claude API key is lost after the crash.
  4. Missing idempotency or locking

    • Feature execution may lack proper locking or idempotent checks, allowing the same feature to be started concurrently during resume and manual state changes (e.g., moving to IN PROGRESS).
  5. Error handling gap

    • A failure in a Claude-backed feature may not be properly isolated, causing the entire app (or Electron main process) to crash instead of failing the single feature gracefully.

Additional Notes

  • The issue is fully mitigated by pausing the specific idea/task.
  • The crash is deterministic and occurs every time the task is moved back to IN PROGRESS.
  • This suggests a strong link between task state transitions, AutoMode resume logic, and Claude subprocess execution.

Steps to Reproduce

  1. Start the Electron app.
  2. Ensure AutoMode is enabled and there is at least one interrupted feature from a previous session.
  3. Observe AutoMode attempting to resume features on startup.
  4. Identify the specific idea/task that causes issues.
  5. Move that idea/task to IN PROGRESS.
  6. Observe the app crash and the Claude process exiting with code 1.
  7. Restart the app and note that the Claude API key is no longer present.
  8. Pause the same idea/task.
  9. Confirm that the app runs normally while the task remains paused.

Expected Behavior

Suggested Next Debugging Steps

  • Add guards to prevent resuming features already marked as running.
  • Log feature/task IDs during AutoMode resume and manual execution to detect duplicates.
  • Verify persistence and rehydration of Claude API keys after abnormal shutdowns.
  • Inspect Claude subprocess spawn/cleanup logic to ensure only one instance runs per feature.
  • Add fault isolation so a single agent failure cannot crash the entire app.

Actual Behavior

Actual Behavior

  • On app startup, AutoMode attempts to resume multiple features and logs errors indicating they are already running.

  • When a specific idea/task is moved to IN PROGRESS, the app crashes.

  • Logs show a Claude-backed feature failing with:

    • Claude Code process exited with code 1
  • After the crash:

    • The Claude API key is missing and must be reconfigured.
    • Pausing the problematic idea/task prevents the crash.
    • Resuming it (moving back to IN PROGRESS) reliably reproduces the issue.

Screenshots

No response

Relevant Logs

POST /api/features/agent-output 200
ERROR [ClaudeProvider] executeQuery() error during execution: {
type: 'execution',
message: 'Claude Code process exited with code 1',
isRateLimit: false,
retryAfter: undefined,
stack: 'Error: Claude Code process exited with code 1\n' +
' at ProcessTransport.getProcessExitError (@anthropic-ai/claude-agent-sdk/sdk.mjs:13248:14)\n' +
' at ChildProcess.exitHandler (@anthropic-ai/claude-agent-sdk/sdk.mjs:13373:28)\n' +
' at Object.onceWrapper (node:events:623:26)\n' +
' at ChildProcess.emit (node:events:520:35)\n' +
' at ChildProcess._handle.onexit (node:internal/child_process:293:12)'
}
ERROR [AutoMode] Feature app-store-grid-view failed: Error: Claude Code process exited with code 1
at ClaudeProvider.executeQuery (server\src\providers\claude-provider.ts:156:29)
at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
at async AutoModeService.runAgent (server\src\services\auto-mode-service.ts:2611:36)
at async AutoModeService.executeFeature (server\src\services\auto-mode-service.ts:639:7) {
originalError: Error: Claude Code process exited with code 1
at ProcessTransport.getProcessExitError (@anthropic-ai/claude-agent-sdk/sdk.mjs:13248:14)
at ChildProcess.exitHandler (@anthropic-ai/claude-agent-sdk/sdk.mjs:13373:28)
at Object.onceWrapper (node:events:623:26)
at ChildProcess.emit (node:events:520:35)
at ChildProcess._handle.onexit (node:internal/child_process:293:12),
type: 'execution'
}

Additional Context

No response

Checklist

  • I have searched existing issues to ensure this bug hasn't been reported already
  • I have provided all required information above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions