{"record":{"id":"6d3aaca5e24e2d05","repo":"larksuite/cli","slug":"output-mode-q-is-invalid","errorCode":null,"errorMessage":"Output.Mode %q is invalid","messagePattern":"Output\\.Mode %q is invalid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_contract.go","lineNumber":92,"sourceCode":"\t\t\t\t}\n\t\t\t\tif fields[fieldIndex].cli.Hidden {\n\t\t\t\t\treturn fmt.Errorf(\"%s references hidden param --%s; use a public canonical param\", path, param)\n\t\t\t\t}\n\t\t\t\tif _, duplicate := seen[param]; duplicate {\n\t\t\t\t\treturn fmt.Errorf(\"%s.Params contains duplicate param --%s\", path, param)\n\t\t\t\t}\n\t\t\t\tseen[param] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validateOutput(definition typedOutputDefinition, dataShape typedValueShape) error {\n\tswitch definition.Mode {\n\tcase typedOutputGeneric, typedOutputFixedJSON:\n\tdefault:\n\t\treturn fmt.Errorf(\"Output.Mode %q is invalid\", definition.Mode)\n\t}\n\treturn nil\n}\n\nfunc decodeJSONPointerSegment(segment string) (string, bool) {\n\tvar builder strings.Builder\n\tfor index := 0; index < len(segment); index++ {\n\t\tif segment[index] != '~' {\n\t\t\tbuilder.WriteByte(segment[index])\n\t\t\tcontinue\n\t\t}\n\t\tif index+1 >= len(segment) {\n\t\t\treturn \"\", false\n\t\t}\n\t\tindex++\n\t\tswitch segment[index] {\n\t\tcase '0':\n\t\t\tbuilder.WriteByte('~')","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_contract.go#L74-L110","documentation":"Thrown when Output.Mode in a typed shortcut definition is neither the generic output mode nor the fixed-JSON mode. The compiler accepts only these two whitelisted modes; any other string (typo, new value, empty) is rejected.","triggerScenarios":"typedOutputDefinition with Mode set to e.g. \"json\", \"table\", \"fixed_json\", or \"\" instead of the exact typedOutputGeneric or typedOutputFixedJSON constants.","commonSituations":"Hand-writing the mode string instead of using the exported constant; assuming a mode name from another CLI; upgrading a definition after mode constants changed.","solutions":["Set Output.Mode to the exported constant (typedOutputGeneric or typedOutputFixedJSON) rather than a raw string","Check the allowed values via --help or schema output for the definition surface","Remove the Mode field if generic output is intended"],"exampleFix":"// before\nOutput: OutputDefinition{Mode: \"json\"}\n// after\nOutput: OutputDefinition{Mode: typedOutputFixedJSON}","handlingStrategy":"validation","validationCode":"switch def.Output.Mode {\ncase \"\", common.TypedOutputGeneric, common.TypedOutputFixedJSON:\ndefault:\n  return fmt.Errorf(\"unsupported Output.Mode %q\", def.Output.Mode)\n}","typeGuard":"func validOutputMode(m string) bool {\n  return m == common.TypedOutputGeneric || m == common.TypedOutputFixedJSON\n}","tryCatchPattern":"if err := common.CompileTypedDefinition(def); err != nil {\n  return fmt.Errorf(\"invalid output mode: %w\", err)\n}","preventionTips":["Always use exported mode constants, never raw strings","Check schema/--help output for accepted values","Let the type system enforce the mode via a typed field if available"],"tags":["go","output","validation","enum"],"backgroundTag":"shortcut-definition-validation-failed","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"}