Skip to content

[BUG] Raw Go error messages leak to end users in chat #564

@rahul-hudle

Description

@rahul-hudle

Description

When the LLM call fails, the raw Go error chain is sent directly to the user in chat. Users see internal error details like HTTP status codes, wrapped error contexts, and Go error formatting.

Current Behavior

Error processing message: LLM call failed after retries: status 401: Unauthorized

This appears in Telegram, Discord, Slack, and all other channels.

Expected Behavior

Users should see a friendly, actionable message:

  • Auth errors: "I couldn't process that — please check your API key in ~/.picoclaw/config.json"
  • Rate limits: "I'm being rate-limited. Please try again in a moment."
  • Network errors: "I couldn't reach the AI provider. Check your internet connection."
  • Generic: "Something went wrong. Run 'picoclaw doctor' to diagnose."

Raw errors should be logged server-side only.

Location

  • pkg/agent/loop.go:161response = fmt.Sprintf("Error processing message: %v", err)

Fix

Add an error classification layer between the agent loop and the user-facing response. Map common error types (401, 429, network timeout, context exceeded) to friendly messages. Log the full error with logger.ErrorCF.

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