{"record":{"id":"a825260573fdcdd7","repo":"dgraph-io/dgraph","slug":"typed-oes-not-match-the-expected","errorCode":null,"errorMessage":"Typed oes not match the expected","messagePattern":"Typed oes not match the expected","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"schema/parse.go","lineNumber":587,"sourceCode":"\t}\n\n\tif it.Item().Typ != itemNewLine {\n\t\treturn nil, it.Item().Errorf(\"Expected new line after field declaration. Got %v\",\n\t\t\tit.Item().Val)\n\t}\n\n\tglog.Warningf(\"Type declaration for type %s includes deprecated information about field type \"+\n\t\t\"for field %s which will be ignored.\", typeName, x.ParseAttr(field.Predicate))\n\treturn field, nil\n}\n\nfunc parseNamespace(it *lex.ItemIterator) (uint64, error) {\n\tnextItems, err := it.Peek(2)\n\tif err != nil {\n\t\treturn 0, errors.Errorf(\"Unable to peek: %v\", err)\n\t}\n\tif nextItems[0].Typ != itemNumber || nextItems[1].Typ != itemRightSquare {\n\t\treturn 0, errors.Errorf(\"Typed oes not match the expected\")\n\t}\n\tns, err := strconv.ParseUint(nextItems[0].Val, 0, 64)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tit.Next()\n\tit.Next()\n\t// We have parsed the namespace. Now move to the next item.\n\tif !it.Next() {\n\t\treturn 0, errors.Errorf(\"No schema found after namespace. Got: %v\", nextItems[0])\n\t}\n\treturn ns, nil\n}\n\n// ParsedSchema represents the parsed schema and type updates.\ntype ParsedSchema struct {\n\tPreds []*pb.SchemaUpdate\n\tTypes []*pb.TypeUpdate","sourceCodeStart":569,"sourceCodeEnd":605,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/schema/parse.go#L569-L605","documentation":"After peeking 2 tokens, parseNamespace requires the first to be an itemNumber and the second a closing ']'. Anything else (e.g. a name token, EOF inside brackets) yields 'Typed oes not match the expected' (typo for 'Type does not match the expected'). It means the syntax after '[' is not a numeric namespace.","triggerScenarios":"Schema text containing '[abc]' or '[ ]' or '[' followed by a predicate name instead of a namespace number, passed to schema.Parse/ParseWithNamespace/ToDirectedEdges.","commonSituations":"Hand-written schema where the author confused namespace syntax with array syntax; copying a GraphQL or JSON schema into DQL schema; missing namespace number inside the brackets.","solutions":["Use the correct namespace syntax: [0x1] (a hex/decimal number followed by ']')","Remove the '[' section entirely if namespaces are not used","Fix the typo'd/malformed token inside the brackets and re-run Parse","Upgrade Dgraph: the error message itself is malformed text and later versions clarify it"],"exampleFix":"// before\nschema := \"[name]\\nname: string .\"  // brackets contain a name, not a number\n// after\nschema := \"[0x1]\\nname: string .\"","handlingStrategy":"validation","validationCode":"re := regexp.MustCompile(`^\\[0x[0-9a-fA-F]+\\]$`)\nfor _, m := range namespaceHeaders(schemaStr) {\n    if !re.MatchString(m) {\n        return fmt.Errorf(\"bad namespace header: %s\", m)\n    }\n}","typeGuard":null,"tryCatchPattern":"if _, err := schema.Parse(s, 0, 1); err != nil {\n    if strings.Contains(err.Error(), \"does not match\") || strings.Contains(err.Error(), \"oes not match\") {\n        return fmt.Errorf(\"invalid namespace syntax in schema: %w\", err)\n    }\n    return err\n}","preventionTips":["Use the exact [0xN] namespace syntax or omit brackets entirely","Template namespace values as numbers, never free-form strings","Lint generated schema before applying","Track the typo'd message text for legacy-version matching"],"tags":["dgraph","schema-parser","parsing","syntax-error"],"backgroundTag":"schema-parse-invalid-namespace","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}