Skip to content

osapi help and osapi completion fail when no config file exists #503

Description

@retr0h

cmd/root.go:54,107 skips config loading only when os.Args[1] is literally version. Cobra's help and completion subcommands therefore try to read the config, and on a fresh install without /etc/osapi/osapi.yaml both exit 1 with failed to read config. Bare --help works because Cobra handles it before initialization. Reproduced by running the built binary.

Fix: decide on the resolved Cobra command rather than raw os.Args, and include help and completion in the skip set.


Found in the September 2026 codebase review. Tracked in the review tracking issue.

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

    bugSomething isn't workingkind/go

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions