{"record":{"id":"1a8cb3c20cebb34f","repo":"cayleygraph/cayley","slug":"wrong-quad-format-s-no-predicate","errorCode":null,"errorMessage":"wrong quad format: '%s': no predicate","messagePattern":"wrong quad format: '(.+?)': no predicate","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"schema/schema.go","lineNumber":194,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"wrong quad tag format: '%s'\", rule)\n\t\t}\n\t} else { // s-p>o // default\n\t\ttri = strings.SplitN(rule, spo, 3)\n\t\tif len(tri) > 2 { //len(tri) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"wrong quad tag format: '%s'\", rule)\n\t\t}\n\t}\n\tvar ps, vs string\n\tif rev {\n\t\tps, vs = strings.Trim(tri[0], trim), strings.Trim(tri[1], trim)\n\t} else {\n\t\tps, vs = strings.Trim(tri[0], trim), any\n\t\tif len(tri) > 1 {\n\t\t\tvs = strings.Trim(tri[1], trim)\n\t\t}\n\t}\n\tif ps == \"\" {\n\t\treturn nil, fmt.Errorf(\"wrong quad format: '%s': no predicate\", rule)\n\t}\n\tp := c.toIRI(ps)\n\tif vs == \"\" || vs == any && fld.Type != reflEmptyStruct {\n\t\treturn saveRule{Pred: p, Rev: rev, Opt: opt}, nil\n\t}\n\treturn constraintRule{Pred: p, Val: c.toIRI(vs), Rev: rev}, nil\n}\n\nfunc checkFieldType(ftp reflect.Type) error {\n\tfor ftp.Kind() == reflect.Ptr || ftp.Kind() == reflect.Slice {\n\t\tftp = ftp.Elem()\n\t}\n\tswitch ftp.Kind() {\n\tcase reflect.Array: // TODO: support arrays\n\t\treturn fmt.Errorf(\"array fields are not supported yet\")\n\tcase reflect.Func, reflect.Invalid:\n\t\treturn fmt.Errorf(\"%v fields are not supported\", ftp.Kind())\n\tdefault:","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/cayleygraph/cayley/blob/81dcd7d73e45136bc0d01802a8ba4685d8a533eb/schema/schema.go#L176-L212","documentation":"The schema parser failed to extract a predicate from a quad-shaped rule string. Rules of the form 'predicate[ value]' must contain a non-empty predicate before the space; an empty predicate part makes the rule meaningless, so generation aborts. This comes from strings.SplitN of the rule string where the first segment trimmed to empty.","triggerScenarios":"Calling Generate on a struct whose tagged rule string starts with a space, contains only whitespace before the value separator (e.g. `tag:\",someIRI\"`), or is effectively empty after trimming.","commonSituations":"Typos in struct tags like `tag:\":value\"` or `tag:\" value\"`; programmatically built rule strings with accidental leading separators; copy-pasted RDF lines missing the predicate column.","solutions":["Fix the struct tag so it begins with a valid predicate IRI or string, e.g. `tag:\"name\"`","Remove stray leading spaces/colons from the rule string before the predicate","Print the offending rule (the %s in the message) and compare against documented quad format 'predicate [value]'"],"exampleFix":"// before\ntype Person struct {\n    Name string `tag:\" nickname\"`\n}\n// after\ntype Person struct {\n    Name string `tag:\"nickname\"`\n}","handlingStrategy":"validation","validationCode":"for _, s := range rules {\n    s = strings.TrimSpace(strings.SplitN(s, \" \", 2)[0])\n    if s == \"\" {\n        return fmt.Errorf(\"rule %q has empty predicate\", s)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep struct tags in the documented 'predicate [value]' format with no leading whitespace","Lint struct tags in CI for the quad tag key","Call Generate at startup so tag errors fail fast"],"tags":["schema","configuration","parsing"],"backgroundTag":"invalid-config-value","analyzedSha":"81dcd7d73e45136bc0d01802a8ba4685d8a533eb","analyzedAt":"2026-09-06T06:14:12.358Z","contentChangedAt":"2026-09-06T06:14:12.358Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}