{"record":{"id":"ba92db9598fb1204","repo":"t8y2/dbx","slug":"sequence-not-found-s-s","errorCode":null,"errorMessage":"sequence not found: %s.%s","messagePattern":"sequence not found: (.+?)\\.(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/xugu/main.go","lineNumber":3512,"sourceCode":"\t\tcandidates = append(candidates, candidate)\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn candidates, nil\n}\n\nfunc selectXuguCatalogSequenceName(schema, name string, candidates []xuguCatalogSequenceName) (string, string, error) {\n\tfor _, candidate := range candidates {\n\t\tif candidate.Schema == schema && candidate.Name == name {\n\t\t\treturn candidate.Schema, candidate.Name, nil\n\t\t}\n\t}\n\tif len(candidates) == 1 {\n\t\treturn candidates[0].Schema, candidates[0].Name, nil\n\t}\n\tif len(candidates) == 0 {\n\t\treturn \"\", \"\", fmt.Errorf(\"sequence not found: %s.%s\", schema, name)\n\t}\n\treturn \"\", \"\", fmt.Errorf(\"sequence name is ambiguous: %s.%s; specify the catalog's exact case\", schema, name)\n}\n\nfunc renderXuguSequenceDDL(sequence xuguSequenceMetadata) string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"CREATE SEQUENCE \")\n\tbuilder.WriteString(quoteIdentifier(sequence.Schema))\n\tbuilder.WriteByte('.')\n\tbuilder.WriteString(quoteIdentifier(sequence.Name))\n\n\tif value := xuguSequenceNumber(sequence.Step); value != \"\" {\n\t\tbuilder.WriteString(\"\\n  INCREMENT BY \")\n\t\tbuilder.WriteString(value)\n\t}\n\tif value := xuguSequenceNumber(sequence.Current); value != \"\" {\n\t\tbuilder.WriteString(\"\\n  START WITH \")\n\t\tbuilder.WriteString(value)","sourceCodeStart":3494,"sourceCodeEnd":3530,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/xugu/main.go#L3494-L3530","documentation":"The sequence resolver matches a schema-qualified sequence name against catalog candidates. When no candidate matches it returns 'sequence not found: <schema>.<name>'. This occurs while resolving sequence metadata or rendering sequence DDL.","triggerScenarios":"Requesting sequence metadata/DDL for schema.name where no such sequence exists in the catalog — wrong schema, wrong sequence name, or the sequence was dropped/renamed.","commonSituations":"Copy-pasted DDL referencing another environment's schema; misspelled schema or sequence name; sequence lives in a different database; tooling generating DDL from stale metadata caches.","solutions":["List sequences in the target schema (or search all schemas) and use an existing schema.name pair.","Correct the schema qualifier — the sequence may exist under a different schema.","Reconnect to the database that actually contains the sequence.","Refresh stale metadata caches and retry."],"exampleFix":"// before\ngetSequenceDDL(\"app\", \"order_seq\") // not found\n// after\nseqs := listSequences() // shows \"sales.order_seq\"\ngetSequenceDDL(\"sales\", \"order_seq\")","handlingStrategy":"validation","validationCode":"seqs := listSequences(schema)\nif !contains(seqs, name) {\n  return fmt.Errorf(\"%s.%s not in catalog\", schema, name)\n}","typeGuard":null,"tryCatchPattern":"if err := getSequenceDDL(schema, name); err != nil {\n  if strings.Contains(err.Error(), \"sequence not found\") {\n    schema, name = locateSequenceGlobally(name) // search other schemas/dbs\n    getSequenceDDL(schema, name)\n  }\n}","preventionTips":["Qualify sequences with the correct schema in all DDL/tooling.","List catalog sequences before generating DDL.","Keep metadata caches fresh across environments.","Verify the target database before metadata RPCs."],"tags":["sequence","not-found","metadata","xugu"],"backgroundTag":"object-not-found","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}