{"record":{"id":"1e161d5c60c019bc","repo":"larksuite/cli","slug":"value-is-not-json-encodable-w","errorCode":null,"errorMessage":"value is not JSON-encodable: %w","messagePattern":"value is not JSON-encodable: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_contract.go","lineNumber":209,"sourceCode":"\t\t\tobject, ok := shapeAsObject(variant)\n\t\t\tif !ok {\n\t\t\t\treturn typedObjectShape{}, false\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tcombined = object\n\t\t\t\tfound = true\n\t\t\t} else if object.AdditionalProperties {\n\t\t\t\tcombined.AdditionalProperties = true\n\t\t\t}\n\t\t}\n\t\treturn combined, found\n\t}\n\treturn typedObjectShape{}, false\n}\nfunc valueCompatibleWithShape(value any, shape typedValueShape) error {\n\tencoded, err := json.Marshal(value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"value is not JSON-encodable: %w\", err)\n\t}\n\tnormalized, err := decodeJSONValidationValue(encoded)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"value is not valid JSON: %w\", err)\n\t}\n\treturn validateJSONValueAgainstShape(normalized, shape, \"value\")\n}\n","sourceCodeStart":191,"sourceCodeEnd":217,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_contract.go#L191-L217","documentation":"compileData rejects a typed data definition that sets both an explicit Output.Data.Shape and Output.Data.Overrides, since a fully explicit shape leaves nothing to override and combining them would be ambiguous. Exactly one authoring style must be chosen.","triggerScenarios":"Passing typedDataDefinition with both Shape != nil and len(Overrides) > 0 to compileData (directly or via compileDefinitionParts).","commonSituations":"Migrating from override-based definitions to explicit shapes and leaving stale overrides in place; copy-pasting a definition and adding a Shape without removing Overrides.","solutions":["Remove the Overrides entries and keep only the explicit Shape.","Remove the explicit Shape and keep Overrides (struct-derived shape + mutations).","If overrides are meant to refine a struct-derived shape, drop Shape and let compilation derive it from the Data struct type."],"exampleFix":"// before\nDefinition{Shape: myShape, Overrides: []Override{{Path:\"/a\", Value:1}}}\n// after\nDefinition{Shape: myShape}","handlingStrategy":"validation","validationCode":"func jsonEncodable(v any) error {\n  var seen map[uintptr]struct{}\n  _, err := json.Marshal(v)\n  return err\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict override Value types to JSON-encodable kinds in your wrappers","Avoid storing chan/func/cyclic references in payload structs","Unit-test custom MarshalJSON implementations"],"tags":["configuration","mutually-exclusive","shape","shortcuts"],"backgroundTag":"mutually-exclusive-options","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"}