{"record":{"id":"7f0e6f36c6390b04","repo":"cayleygraph/cayley","slug":"unknown-quad-format-q","errorCode":null,"errorMessage":"unknown quad format %q","messagePattern":"unknown quad format %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/load.go","lineNumber":102,"sourceCode":"\tswitch typ {\n\tcase \"cquad\", \"nquad\": // legacy\n\t\tqr = nquads.NewReader(r, false)\n\tdefault:\n\t\tvar format *quad.Format\n\t\tif typ == \"\" {\n\t\t\tname := filepath.Base(path)\n\t\t\tname = strings.TrimSuffix(name, \".gz\")\n\t\t\tname = strings.TrimSuffix(name, \".bz2\")\n\t\t\tformat = quad.FormatByExt(filepath.Ext(name))\n\t\t\tif format == nil {\n\t\t\t\ttyp = \"nquads\"\n\t\t\t}\n\t\t}\n\t\tif format == nil {\n\t\t\tformat = quad.FormatByName(typ)\n\t\t}\n\t\tif format == nil {\n\t\t\terr = fmt.Errorf(\"unknown quad format %q\", typ)\n\t\t} else if format.Reader == nil {\n\t\t\terr = fmt.Errorf(\"decoding of %q is not supported\", typ)\n\t\t}\n\t\tif err != nil {\n\t\t\tif c != nil {\n\t\t\t\tc.Close()\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tqr = format.Reader(r)\n\t}\n\tif c != nil {\n\t\treturn readCloser{ReadCloser: qr, close: c.Close}, nil\n\t}\n\treturn qr, nil\n}\n\n// DecompressAndLoad will load or fetch a graph from the given path, decompress","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/cayleygraph/cayley/blob/81dcd7d73e45136bc0d01802a8ba4685d8a533eb/internal/load.go#L84-L120","documentation":"This error means QuadReaderFor could not resolve the quad serialization format for the given type string. The loader first tries registered format writers (via writerQuadTypes/format registry) and then falls back to quad.FormatByName(typ); if both return nil, the name is not a known quad format, so loading is aborted. It exists to fail fast on a misspelled or unsupported --format / configuration value before any data is read.","triggerScenarios":"Calling internal.QuadReaderFor (directly or via internal.DecompressAndLoad from internal.Load, e.g. `cayley load`) with a file whose detected/derived typ string has no registered format: a misspelled format name like 'nquad' instead of 'nquads', or an unknown file extension, or passing a typ that quad.FormatByName does not recognize.","commonSituations":"Typo in the format flag or config (e.g. \"nquad\", \"NQuads\", \"triples\"); loading a file with an unrecognized extension; a Cayley build/version where a given format is not registered; scripts hard-coding a format string from another tool.","solutions":["Check the format name against quad.RegisterFormat registrations (e.g. \"nquads\", \"jsonld\"); fix the spelling in the CLI flag or config.","If the file extension drives detection, rename the file to the expected extension or pass the format explicitly.","Run `cayley ` with the supported formats listed in the docs to confirm which names exist in your build.","If the format genuinely does not exist, convert the data to nquads first (e.g. with a serializer) and load that."],"exampleFix":"// before\ncayley load --format nquad data.nq\n// after\ncayley load --format nquads data.nq","handlingStrategy":"validation","validationCode":"if quad.FormatByName(formatName) == nil {\n\treturn fmt.Errorf(\"unsupported quad format: %q (use nquads, jsonld, ...)\", formatName)\n}\n_, err := internal.QuadReaderFor(ctx, path, formatName, compress)\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a list of valid format names from quad.RegisterFormat and validate CLI/config values against it.","Let format be inferred from the file extension instead of hand-typing it.","Test your load pipeline with a tiny sample file before large imports."],"tags":["go","quad-format","configuration","loading"],"backgroundTag":"invalid-enum-value","analyzedSha":"81dcd7d73e45136bc0d01802a8ba4685d8a533eb","analyzedAt":"2026-09-06T06:14:12.358Z","contentChangedAt":"2026-09-06T06:14:12.358Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}