{"record":{"id":"c0f8ab8c95ac82fb","repo":"larksuite/cli","slug":"hooks-newargs-panicked-v","errorCode":null,"errorMessage":"Hooks.NewArgs panicked: %v","messagePattern":"Hooks\\.NewArgs panicked: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_external.go","lineNumber":69,"sourceCode":"\t}\n\tif err := validateExternalFlagNamespace(compiled); err != nil {\n\t\treturn Shortcut{}, err\n\t}\n\tshortcut := shortcutFromCompiled(compiled)\n\tif definition.PageOutput {\n\t\tshortcut.Flags = append(shortcut.Flags, PageAllFlags()...)\n\t}\n\tif err := validateTypedFlagMountPlan(compiled, shortcut.PrintFlagSchema != nil, typedRisk(shortcut.Risk)); err != nil {\n\t\treturn Shortcut{}, err\n\t}\n\treturn shortcut, nil\n}\n\nfunc probeNewArgs(newArgs func() any) (result any, err error) {\n\tdefer func() {\n\t\tif recovered := recover(); recovered != nil {\n\t\t\tresult = nil\n\t\t\terr = fmt.Errorf(\"Hooks.NewArgs panicked: %v\", recovered)\n\t\t}\n\t}()\n\treturn newArgs(), nil\n}\n\nfunc adaptBridgeHooks(hooks commandbridge.Hooks) compiledHooks {\n\tadapted := compiledHooks{\n\t\tnewArgs:   hooks.NewArgs,\n\t\tnormalize: hooks.Normalize,\n\t\tvalidate:  hooks.Validate,\n\t\trenderers: hooks.Renderers,\n\t}\n\tif hooks.DryRun != nil {\n\t\tadapted.dryRun = func(ctx context.Context, runtime typedRuntimeContext, args any) (*DryRunAPI, error) {\n\t\t\tvalue, err := hooks.DryRun(ctx, runtime, args)\n\t\t\tif err != nil || value == nil {\n\t\t\t\treturn nil, err\n\t\t\t}","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_external.go#L51-L87","documentation":"probeNewArgs recovered a panic out of the author-supplied Hooks.NewArgs constructor - the definition's args factory is buggy; the recovered value is formatted into this error instead of crashing mount.","triggerScenarios":"Thrown at shortcuts/common/typed_external.go:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix NewArgs so it constructs the Args value without panicking (nil maps, bad receivers, etc.)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}