{"record":{"id":"81c8c1308aeee093","repo":"grpc-ecosystem/grpc-gateway","slug":"usage-openapiv3-merge-file-file","errorCode":null,"errorMessage":"usage: openapiv3-merge FILE [FILE ...]","messagePattern":"usage: openapiv3-merge FILE \\[FILE \\.\\.\\.\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"openapiv3-merge/main.go","lineNumber":40,"sourceCode":"\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\n\t\"github.com/grpc-ecosystem/grpc-gateway/v2/openapiv3-merge/internal/merge\"\n)\n\nfunc main() {\n\tif err := run(os.Args[1:], os.Stdout); err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"openapiv3-merge:\", err)\n\t\tos.Exit(1)\n\t}\n}\n\n// run is the testable entry point. It accepts the program's arguments (no\n// program name) and the writer to emit the merged document to.\nfunc run(args []string, out io.Writer) error {\n\tif len(args) == 0 {\n\t\treturn errors.New(\"usage: openapiv3-merge FILE [FILE ...]\")\n\t}\n\tinputs := make([]merge.Input, 0, len(args))\n\tfor _, path := range args {\n\t\tdata, err := os.ReadFile(path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"read %s: %w\", path, err)\n\t\t}\n\t\tinputs = append(inputs, merge.Input{Name: path, Data: data})\n\t}\n\tmerged, err := merge.Merge(inputs)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := out.Write(merged); err != nil {\n\t\treturn err\n\t}\n\tif _, err := io.WriteString(out, \"\\n\"); err != nil {\n\t\treturn err","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/openapiv3-merge/main.go#L22-L58","documentation":"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.","triggerScenarios":"Thrown at openapiv3-merge/main.go:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the tool with at least one file: openapiv3-merge FILE [FILE ...].","Check shell quoting/globbing if arguments were expected but not received."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a58a4436a376a4bcc7d8f10c4d4f919a8438bba9","analyzedAt":"2026-09-02T10:28:31.537Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}