Skip to content

fix: error handling — Cobra double-print, discarded errors, os.Exit in library #16

Description

@robbycochran

Problems

Cobra double-prints errors (all commands)

Commands that call status.Fail() AND return fmt.Errorf() produce triple output: status line + Cobra "Error:" on stderr + Cobra usage text. Bash version prints clean message and exits.

Fix: Set SilenceErrors = true and SilenceUsage = true on the root command.

Discarded mutation errors

  • deploy.go:82gw.GatewaySelect() error discarded; if it fails, InferenceGet gives misleading error
  • teardown.go:78,103SandboxDelete/ProviderDelete errors discarded in loops
  • new.go:170SandboxDelete during retry cleanup unchecked
  • teardown.go:72,92,97SandboxList/ProviderList errors discarded; reports "None" when listing actually failed

Fix: Check errors. For teardown loops, at minimum print a warning. For SandboxList/ProviderList, distinguish "empty" from "failed".

os.Exit(1) in library code

internal/preflight/check.go:165 calls os.Exit(1) directly instead of returning an error. Makes the strict-failure path untestable.

Fix: Return ErrPreflightFailed sentinel error; let cmd layer handle exit code.

providers.go ProviderList/InferenceGet results silently discarded

providers.go:140-143 calls gw.ProviderList() and gw.InferenceGet() but discards return values. User sees section headers with no content underneath. Bash shows the full CLI table.

Fix: Use passthrough calls or print the returned names.

Severity: Medium

Found by: 5-dimension code audit (code quality + equivalence review)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions