{"record":{"id":"2882233835719324","repo":"t8y2/dbx","slug":"synonym-not-found-s-s","errorCode":null,"errorMessage":"synonym not found: %s.%s","messagePattern":"synonym not found: (.+?)\\.(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/xugu/main.go","lineNumber":3686,"sourceCode":"\t\t} else {\n\t\t\tcandidate.Schema = schema.String\n\t\t}\n\t\tcandidates = append(candidates, candidate)\n\t}\n\treturn candidates, rows.Err()\n}\n\nfunc selectXuguCatalogSynonym(schema, name string, candidates []xuguCatalogSynonym) (xuguCatalogSynonym, error) {\n\tfor _, candidate := range candidates {\n\t\tif candidate.Schema == schema && candidate.Name == name {\n\t\t\treturn candidate, nil\n\t\t}\n\t}\n\tif len(candidates) == 1 {\n\t\treturn candidates[0], nil\n\t}\n\tif len(candidates) == 0 {\n\t\treturn xuguCatalogSynonym{}, fmt.Errorf(\"synonym not found: %s.%s\", schema, name)\n\t}\n\treturn xuguCatalogSynonym{}, fmt.Errorf(\"synonym name is ambiguous: %s.%s; specify the catalog's exact case\", schema, name)\n}\n\nfunc xuguSequenceNumber(value any) string {\n\treturn strings.TrimSpace(xuguString(value))\n}\n\nfunc (s *server) getTableDDL(schema, table string) (string, error) {\n\t// Resolve the catalog's stored casing before issuing exact metadata lookups,\n\t// so emitted DDL quotes the original names and preserves double-quoted\n\t// schema/table/column spellings.\n\tif strings.TrimSpace(schema) != \"\" {\n\t\tif err := s.setSchema(schema); err != nil {\n\t\t\tif !isXuguMetadataAccessError(err) {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}","sourceCodeStart":3668,"sourceCodeEnd":3704,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/xugu/main.go#L3668-L3704","documentation":"resolveCatalogSynonym looks up a synonym across candidate schemas and returns this error when zero candidates match. The synonym simply does not exist in the catalogs the driver queried, or the exact-case lookup plus the case-insensitive fallback both failed.","triggerScenarios":"Requesting DDL/source for a synonym schema.name that has no rows in the synonym catalog — wrong schema, wrong name, or the synonym lives in a different database (CURRENT_DB_ID filter).","commonSituations":"Typo in the synonym name; querying the wrong schema; the synonym was dropped by another session; connecting to a different database instance than expected; quoting identifiers with unexpected casing in a case-sensitive catalog.","solutions":["Verify the synonym exists: SELECT * FROM ALL_SYNONYMS WHERE UPPER(SYNONYM_NAME)=UPPER('<name>') AND UPPER(SCHEMA_NAME)=UPPER('<schema>');","Check you are connected to the intended database (the query filters on CURRENT_DB_ID).","Fix the schema/name arguments passed to the driver — including exact case if the catalog is case-sensitive.","Create the synonym if it is genuinely missing."],"exampleFix":"// before\nddl, err := srv.GetObjectDDL(\"AP\", \"ORDER_SYNONYM\") // synonym is actually in SALES schema\n\n// after\nddl, err := srv.GetObjectDDL(\"SALES\", \"ORDER_SYNONYM\")","handlingStrategy":"try-catch","validationCode":"var n int\ndb.QueryRow(`SELECT COUNT(*) FROM ALL_SYNONYMS WHERE UPPER(SCHEMA_NAME)=UPPER(?) AND UPPER(SYNONYM_NAME)=UPPER(?)`, schema, name).Scan(&n)\nif n == 0 { return fmt.Errorf(\"synonym %s.%s does not exist in this database\", schema, name) }","typeGuard":null,"tryCatchPattern":"if strings.HasPrefix(err.Error(), \"synonym not found:\") {\n    return fmt.Errorf(\"%w: check schema/name and current database\", err)\n}","preventionTips":["Check existence before DDL extraction.","Confirm the connection string points at the intended database.","Keep migration scripts drop/create balanced so synonyms are not lost."],"tags":["database","synonym","not-found"],"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-14T05:17:10.506Z"}