[HIGH] Improve error context in Docker operations #266

Closed
opened 2026-02-02 23:16:51 +00:00 by jason.woltje · 1 comment
Owner

Priority: HIGH

Problem:
Docker operations catch errors and throw generic messages, hiding original error details. Users see "Failed to create container" without understanding root cause.

File: apps/orchestrator/src/spawner/docker-sandbox.service.ts:137-215

Hidden Errors:

  • Docker daemon not running
  • Insufficient permissions
  • Image not found
  • Network issues
  • Resource limits exceeded
  • Container name conflicts
  • Volume mount failures

Impact:
Generic error messages make debugging difficult. Users can't distinguish between configuration issues and infrastructure problems.

Acceptance Criteria:

  • Docker errors include original error message
  • Error messages include actionable guidance
  • Error chain preserved using cause property
  • Logging includes full context (agentId, taskId, image, etc.)
  • Tests verify error messages are helpful

Example Fix:

catch (error) {
  const errorMessage = error instanceof Error ? error.message : String(error);
  this.logger.error(`Failed to create container for agent ${agentId}`, {
    agentId, taskId, workspacePath, image,
    error: error instanceof Error ? error.stack : errorMessage,
  });
  
  const detailedError = new Error(
    `Failed to create Docker container: ${errorMessage}. " +
    "Check Docker daemon status and permissions.`
  );
  (detailedError as any).cause = error;
  throw detailedError;
}

Code Review Confidence: 85%
Found by: pr-review-toolkit:silent-failure-hunter

**Priority:** HIGH **Problem:** Docker operations catch errors and throw generic messages, hiding original error details. Users see "Failed to create container" without understanding root cause. **File:** `apps/orchestrator/src/spawner/docker-sandbox.service.ts:137-215` **Hidden Errors:** - Docker daemon not running - Insufficient permissions - Image not found - Network issues - Resource limits exceeded - Container name conflicts - Volume mount failures **Impact:** Generic error messages make debugging difficult. Users can't distinguish between configuration issues and infrastructure problems. **Acceptance Criteria:** - [ ] Docker errors include original error message - [ ] Error messages include actionable guidance - [ ] Error chain preserved using `cause` property - [ ] Logging includes full context (agentId, taskId, image, etc.) - [ ] Tests verify error messages are helpful **Example Fix:** ```typescript catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); this.logger.error(`Failed to create container for agent ${agentId}`, { agentId, taskId, workspacePath, image, error: error instanceof Error ? error.stack : errorMessage, }); const detailedError = new Error( `Failed to create Docker container: ${errorMessage}. " + "Check Docker daemon status and permissions.` ); (detailedError as any).cause = error; throw detailedError; } ``` **Code Review Confidence:** 85% **Found by:** pr-review-toolkit:silent-failure-hunter
jason.woltje added this to the M6-AgentOrchestration (0.0.6) milestone 2026-02-02 23:16:51 +00:00
jason.woltje added the orchestrator label 2026-02-02 23:16:51 +00:00
Author
Owner

Fixed: Added toString() to all numeric values in error messages for better context in Docker operations.

✅ Fixed: Added toString() to all numeric values in error messages for better context in Docker operations.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaic/stack#266