{"record":{"id":"514d8429f71b11cf","repo":"larksuite/cli","slug":"dry-run-request-d-w","errorCode":null,"errorMessage":"dry-run request %d: %w","messagePattern":"dry-run request (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/commandhost/compile.go","lineNumber":327,"sourceCode":"\t\t\treturn nil\n\t\t}\n\t\treflected = reflected.Elem()\n\t}\n\treturn reflected.Interface()\n}\n\nfunc convertDryRun(preview *command.DryRun) (*common.DryRunAPI, error) {\n\tif preview == nil {\n\t\treturn nil, nil\n\t}\n\tview := command.InspectDryRun(preview)\n\tconverted := common.NewDryRunAPI()\n\tif view.Description != \"\" {\n\t\tconverted.Desc(view.Description)\n\t}\n\tfor index, request := range view.Requests {\n\t\tif err := command.ValidateRequestView(request); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"dry-run request %d: %w\", index+1, err)\n\t\t}\n\t\tswitch request.Method {\n\t\tcase \"GET\":\n\t\t\tconverted.GET(request.Path)\n\t\tcase \"POST\":\n\t\t\tconverted.POST(request.Path)\n\t\tcase \"PUT\":\n\t\t\tconverted.PUT(request.Path)\n\t\tcase \"PATCH\":\n\t\t\tconverted.PATCH(request.Path)\n\t\tcase \"DELETE\":\n\t\t\tconverted.DELETE(request.Path)\n\t\t}\n\t\tif params := projectedQuery(request.Query); len(params) > 0 {\n\t\t\tconverted.Params(params)\n\t\t}\n\t\tif request.Body != nil {\n\t\t\tconverted.Body(request.Body)","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/commandhost/compile.go#L309-L345","documentation":"convertDryRun validates each request in a shortcut's dry-run view via command.ValidateRequestView before converting it to common.NewDryRunAPI calls. A request failing that validation aborts conversion with this positional wrapper.","triggerScenarios":"A DryRunView.Requests entry fails ValidateRequestView — e.g. empty path, unsupported field combination, or invalid request shape — while compiling a shortcut's dry-run.","commonSituations":"Hand-writing a dry-run request with a missing Path; a method that is not GET/POST/PUT/PATCH/DELETE after validation passed; refactoring view types so a nil/zero request slips in.","solutions":["Read the wrapped ValidateRequestView error for the exact violated field","Fix the request at index N (1-based per the message): typically supply a valid Path and Method","Add/adjust a unit test mirroring TestConvertDryRunValidatesFileIntent for the new shape"],"exampleFix":"// before\nRequests: []command.RequestView{{Method: \"GET\"}}\n// after\nRequests: []command.RequestView{{Method: \"GET\", Path: \"/open-apis/doc/v2/get\"}}","handlingStrategy":"validation","validationCode":"for i, r := range view.Requests {\n    if err := command.ValidateRequestView(r); err != nil {\n        return fmt.Errorf(\"dry-run request %d: %w\", i+1, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"shortcut, err := commandhost.CompileSets(sets)\nif err != nil && strings.Contains(err.Error(), \"dry-run request\") {\n    return fmt.Errorf(\"fix DryRunView requests: %w\", err)\n}","preventionTips":["Run command.ValidateRequestView on each request at construction time","Give every dry-run request an explicit Method and Path","Keep a table-driven test over all shipped DryRunViews"],"tags":["go","dry-run","validation"],"backgroundTag":"invalid-dry-run-request","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}