{"record":{"id":"12a130198aa0355a","repo":"larksuite/cli","slug":"schema-token-s-does-not-accept-a-value","errorCode":null,"errorMessage":"schema token %s does not accept a value","messagePattern":"schema token (.+?) does not accept a value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_args.go","lineNumber":425,"sourceCode":"\t\tkey, value, hasValue := strings.Cut(token, \"=\")\n\t\tif _, duplicate := seen[key]; duplicate {\n\t\t\treturn result, fmt.Errorf(\"schema token %q is duplicated\", key)\n\t\t}\n\t\tseen[key] = struct{}{}\n\t\tswitch key {\n\t\tcase \"required\":\n\t\t\tif hasValue {\n\t\t\t\treturn result, fmt.Errorf(\"schema token required does not accept a value\")\n\t\t\t}\n\t\t\tresult.required = true\n\t\tcase \"optional\":\n\t\t\tif hasValue {\n\t\t\t\treturn result, fmt.Errorf(\"schema token optional does not accept a value\")\n\t\t\t}\n\t\t\tresult.optional = true\n\t\tcase \"nullable\", \"nonnullable\":\n\t\t\tif hasValue {\n\t\t\t\treturn result, fmt.Errorf(\"schema token %s does not accept a value\", key)\n\t\t\t}\n\t\t\tif result.nullable != nil {\n\t\t\t\treturn result, fmt.Errorf(\"schema cannot declare both nullable and nonnullable\")\n\t\t\t}\n\t\t\tv := key == \"nullable\"\n\t\t\tresult.nullable = &v\n\t\tcase \"default\":\n\t\t\tif !hasValue || value == \"\" {\n\t\t\t\treturn result, fmt.Errorf(\"schema default requires a JSON literal\")\n\t\t\t}\n\t\t\tif !input {\n\t\t\t\treturn result, fmt.Errorf(\"Data field cannot declare default\")\n\t\t\t}\n\t\t\tvar decoded any\n\t\t\tif err := json.Unmarshal([]byte(value), &decoded); err != nil {\n\t\t\t\treturn result, fmt.Errorf(\"schema default is not valid JSON: %w\", err)\n\t\t\t}\n\t\t\tresult.defaultValue = typedInputDefault{Set: true, Value: decoded}","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_args.go#L407-L443","documentation":"Thrown by parseSchemaTag when the nullable or nonnullable token is given a value (e.g. nullable=true). Both are mutually exclusive bare markers; a value is not accepted, and declaring both is also rejected immediately after.","triggerScenarios":"A tag like `schema:\"required;nullable=true\"`; the case \"nullable\",\"nonnullable\" branch checks hasValue and formats the offending key into the message.","commonSituations":"Applying key=value style uniformly; copying boolean attribute syntax from OpenAPI/JSON-Schema into the tag; generators emitting nullable=false for non-nullable fields.","solutions":["Write bare `nullable` or `nonnullable` with no value","Use `nonnullable` instead of `nullable=false`","Ensure only one of nullable/nonnullable appears in the tag"],"exampleFix":"// before\nName string `cli:\"--name;schema:\\\"required;nullable=true\\\"\"`\n// after\nName string `cli:\"--name;schema:\\\"required;nullable\\\"\"`","handlingStrategy":"validation","validationCode":"if (key == \"nullable\" || key == \"nonnullable\") && strings.Contains(token, \"=\") {\n    return fmt.Errorf(\"%s must be a bare token\", key)\n}\nif strings.Contains(tag, \"nullable\") && strings.Contains(tag, \"nonnullable\") {\n    return fmt.Errorf(\"declare only one of nullable/nonnullable\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use bare nullable/nonnullable tokens","Never write nullable=true/false","Declare at most one nullability marker per tag"],"tags":["cli","schema","tags","grammar","validation"],"backgroundTag":"schema-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"}