grpc-ecosystem/grpc-gateway · error
usage: openapiv3-merge FILE [FILE ...]
Error message
usage: openapiv3-merge FILE [FILE ...]
What it means
Usage error returned by the openapiv3-merge CLI entry point run(): it was invoked with zero FILE arguments. The tool requires one or more OpenAPI JSON documents to merge; without args there is nothing to merge, so it reports usage and main exits with status 1.
Source
Thrown at openapiv3-merge/main.go:40
"fmt"
"io"
"os"
"github.com/grpc-ecosystem/grpc-gateway/v2/openapiv3-merge/internal/merge"
)
func main() {
if err := run(os.Args[1:], os.Stdout); err != nil {
fmt.Fprintln(os.Stderr, "openapiv3-merge:", err)
os.Exit(1)
}
}
// run is the testable entry point. It accepts the program's arguments (no
// program name) and the writer to emit the merged document to.
func run(args []string, out io.Writer) error {
if len(args) == 0 {
return errors.New("usage: openapiv3-merge FILE [FILE ...]")
}
inputs := make([]merge.Input, 0, len(args))
for _, path := range args {
data, err := os.ReadFile(path)
if err != nil {
return fmt.Errorf("read %s: %w", path, err)
}
inputs = append(inputs, merge.Input{Name: path, Data: data})
}
merged, err := merge.Merge(inputs)
if err != nil {
return err
}
if _, err := out.Write(merged); err != nil {
return err
}
if _, err := io.WriteString(out, "\n"); err != nil {
return errView on GitHub (pinned to a58a4436a3)
Solutions
- Run the tool with at least one file: openapiv3-merge FILE [FILE ...].
- Check shell quoting/globbing if arguments were expected but not received.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at openapiv3-merge/main.go:40 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grpc-ecosystem/grpc-gateway@a58a4436a3 (2026-09-02).
Data as JSON: /api/errors/81c8c1308aeee093.
Report an issue: GitHub.