{"record":{"id":"a5e01ce7ab473c8b","repo":"larksuite/cli","slug":"s-field-s-s-w","errorCode":null,"errorMessage":"%s field %s (%s): %w","messagePattern":"(.+?) field (.+?) \\((.+?)\\): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_data.go","lineNumber":229,"sourceCode":"\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s json tag must explicitly name the field\", path, field.Name)\n\t\t}\n\t\tomitempty := false\n\t\tfor _, option := range parts[1:] {\n\t\t\tswitch option {\n\t\t\tcase \"omitempty\":\n\t\t\t\tomitempty = true\n\t\t\tcase \"\":\n\t\t\tdefault:\n\t\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s has unsupported json option %q\", path, field.Name, option)\n\t\t\t}\n\t\t}\n\t\tif previous, exists := seen[name]; exists {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s JSON name %q duplicates field %s\", path, field.Name, name, previous)\n\t\t}\n\t\tseen[name] = field.Name\n\t\tschema, err := parseSchemaTag(field.Tag.Get(\"schema\"), field.Type, input)\n\t\tif err != nil {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s (%s): %w\", path, field.Name, name, err)\n\t\t}\n\t\tif !input && schema.defaultValue.Set {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s (%s): Data field cannot declare default\", path, field.Name, name)\n\t\t}\n\t\tif schema.required && omitempty {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s (%s): required Data field cannot use omitempty\", path, field.Name, name)\n\t\t}\n\t\tif schema.optional && !omitempty {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s (%s): optional Data field must use omitempty\", path, field.Name, name)\n\t\t}\n\t\tif isNilCapable(field.Type) && schema.nullable == nil {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s (%s): nil-capable field must declare nullable or nonnullable\", path, field.Name, name)\n\t\t}\n\t\tdescription := strings.TrimSpace(field.Tag.Get(\"doc\"))\n\t\tif input && description == \"\" {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s (%s): description is required via doc\", path, field.Name, name)\n\t\t}\n\t\tfieldShape, err := shapeForType(field.Type, schema, input, active)","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_data.go#L211-L247","documentation":"This is a wrapping error: parsing the field's `schema:` tag failed and the cause (e.g. invalid schema option, wrong type usage) is preserved via %w. It adds context — which struct path, field, and JSON name — around the underlying parseSchemaTag error.","triggerScenarios":"Any malformed or invalid `schema:` tag (e.g. `schema:\"requird\"`, conflicting options, type-incompatible option) on a field compiled through compileStructShape.","commonSituations":"Typos in schema keywords; combining mutually exclusive options like required+optional; applying an option invalid for the field's Go type; SDK version change renaming a schema keyword.","solutions":["Read the wrapped cause message (%w) for the actual parse failure and fix the `schema:` tag accordingly","Check valid schema keywords in the library's schema tag documentation","Remove options that don't apply to the field's type"],"exampleFix":"// before\nName string `json:\"name\" schema:\"requird\" doc:\"...\"`\n// after\nName string `json:\"name\" schema:\"required\" doc:\"...\"`","handlingStrategy":"try-catch","validationCode":"// Validate schema tags before registration using the library's own parser\nif err := parseSchemaTag(f.Tag.Get(\"schema\"), f.Type, input); err != nil {\n    return fmt.Errorf(\"field %s: %w\", f.Name, err)\n}","typeGuard":null,"tryCatchPattern":"shape, err := common.ShapeForType(myType)\nif errors.Is(err, someSchemaParseErr) {\n    // inspect errors.Unwrap / %s for the offending schema option\n    log.Fatalf(\"invalid schema tag: %v\", err)\n}","preventionTips":["Copy schema keywords only from documented examples","Keep schema options minimal per field","Add compile tests covering each distinct schema option you use"],"tags":["go","struct-tags","schema","error-wrapping"],"backgroundTag":"invalid-schema-tag","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"}