{"record":{"id":"3fd757ee1766aa11","repo":"larksuite/cli","slug":"sheets-no-flag-defs-json-entry-for-q","errorCode":null,"errorMessage":"sheets: no flag-defs.json entry for %q","messagePattern":"sheets: no flag-defs\\.json entry for %q","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/flag_defs.go","lineNumber":63,"sourceCode":"// The error return is always nil; it is retained so existing call sites that\n// handled a parse error keep compiling. There is no longer a runtime parse.\nfunc loadFlagDefs() (map[string]commandDef, error) {\n\treturn flagDefs, nil\n}\n\n// flagsFor builds the []common.Flag for a shortcut command directly from\n// flag-defs.json. System-kind flags are skipped (the framework injects\n// them). Panics if the command is absent or the JSON is malformed — this\n// is a build-time data contract, so a missing entry is a programming error\n// surfaced loudly at startup rather than a silent empty flag set.\nfunc flagsFor(command string) []common.Flag {\n\tdefs, err := loadFlagDefs()\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"sheets: %v\", err))\n\t}\n\tspec, ok := defs[command]\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"sheets: no flag-defs.json entry for %q\", command))\n\t}\n\tout := make([]common.Flag, 0, len(spec.Flags))\n\tfor _, df := range spec.Flags {\n\t\tif df.Kind == \"system\" {\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, common.Flag{\n\t\t\tName:     df.Name,\n\t\t\tType:     df.Type,\n\t\t\tDefault:  df.Default,\n\t\t\tDesc:     df.Desc,\n\t\t\tHidden:   df.Hidden,\n\t\t\tRequired: df.Required == \"required\",\n\t\t\tEnum:     df.Enum,\n\t\t\tInput:    df.Input,\n\t\t})\n\t}\n\treturn out","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/flag_defs.go#L45-L81","documentation":"flagsFor panics when the compiled flag-defs table has no entry for the requested sheets command - a missing entry means the command's flag surface was never generated, and a silent empty flag set would be worse.","triggerScenarios":"Thrown at shortcuts/sheets/flag_defs.go:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Regenerate flag-defs.json/flag_defs_gen.go so it includes the command, or fix the command key"],"exampleFix":null,"handlingStrategy":"validation","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"}