Skip to content

fix(bot): replace catch unreachable with proper error handling in claude_stream.zig #150

Description

@gHashTag

Task

In tools/mcp/trinity_mcp/bot/claude_stream.zig line 67, the URI parsing uses catch unreachable:

const uri = std.Uri.parse(api_url) catch unreachable;

This is unsafe because api_url is built dynamically from environment variables and could be malformed.

Fix

Replace with proper error handling that returns an error instead of panicking:

const uri = std.Uri.parse(api_url) catch |err| {
    std.log.err("Invalid API URL: {s} — {}", .{ api_url, err });
    return error.InvalidUrl;
};

File

  • tools/mcp/trinity_mcp/bot/claude_stream.zig — line 67

Acceptance

  • zig build compiles without errors
  • zig fmt passes
  • No catch unreachable on URI parsing

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:spawnAuto-spawn agent container

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions