larksuite/cli · error
dry-run request %d: %w
Error message
dry-run request %d: %w
What it means
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.
Source
Thrown at internal/commandhost/compile.go:327
return nil
}
reflected = reflected.Elem()
}
return reflected.Interface()
}
func convertDryRun(preview *command.DryRun) (*common.DryRunAPI, error) {
if preview == nil {
return nil, nil
}
view := command.InspectDryRun(preview)
converted := common.NewDryRunAPI()
if view.Description != "" {
converted.Desc(view.Description)
}
for index, request := range view.Requests {
if err := command.ValidateRequestView(request); err != nil {
return nil, fmt.Errorf("dry-run request %d: %w", index+1, err)
}
switch request.Method {
case "GET":
converted.GET(request.Path)
case "POST":
converted.POST(request.Path)
case "PUT":
converted.PUT(request.Path)
case "PATCH":
converted.PATCH(request.Path)
case "DELETE":
converted.DELETE(request.Path)
}
if params := projectedQuery(request.Query); len(params) > 0 {
converted.Params(params)
}
if request.Body != nil {
converted.Body(request.Body)View on GitHub (pinned to 7fd6ef3c07)
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
Example fix
// before
Requests: []command.RequestView{{Method: "GET"}}
// after
Requests: []command.RequestView{{Method: "GET", Path: "/open-apis/doc/v2/get"}} Defensive patterns
Strategy: validation
Validate before calling
for i, r := range view.Requests {
if err := command.ValidateRequestView(r); err != nil {
return fmt.Errorf("dry-run request %d: %w", i+1, err)
}
} Try / catch
shortcut, err := commandhost.CompileSets(sets)
if err != nil && strings.Contains(err.Error(), "dry-run request") {
return fmt.Errorf("fix DryRunView requests: %w", err)
} Prevention
- 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
When it happens
Trigger: A DryRunView.Requests entry fails ValidateRequestView — e.g. empty path, unsupported field combination, or invalid request shape — while compiling a shortcut's dry-run.
Common situations: 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.
Related errors
- Invalid column: {column!r}
- Invalid column index: {index}
- anchor outside sheet: {position!r}
- Missing row_count/column_count for sheet {sheet_title(sheet)
- Missing sheet_id for sheet {title!r}
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/514d8429f71b11cf.
Report an issue: GitHub.