{"record":{"id":"7e02cd7b08c6cd94","repo":"t8y2/dbx","slug":"oracle-tnsnames-ora-was-not-found-in-tns-admin-dir","errorCode":null,"errorMessage":"Oracle tnsnames.ora was not found in TNS_ADMIN directory: %s","messagePattern":"Oracle tnsnames\\.ora was not found in TNS_ADMIN directory: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/oracle-go/tns.go","lineNumber":97,"sourceCode":"\tdescriptor, ok := aliases[strings.ToUpper(config.Alias)]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"Oracle TNS alias %q was not found in %s\", config.Alias, tnsNamesPath)\n\t}\n\treturn descriptor, nil\n}\n\nfunc oracleTNSNamesPath(tnsAdmin string) (string, error) {\n\tpath := filepath.Clean(strings.TrimSpace(tnsAdmin))\n\tinfo, err := os.Stat(path)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Oracle TNS_ADMIN directory is not accessible: %s\", path)\n\t}\n\tif !info.IsDir() {\n\t\treturn \"\", fmt.Errorf(\"Oracle TNS_ADMIN must be a directory containing tnsnames.ora: %s\", path)\n\t}\n\ttnsNamesPath := filepath.Join(path, \"tnsnames.ora\")\n\tif info, err := os.Stat(tnsNamesPath); err != nil || info.IsDir() {\n\t\treturn \"\", fmt.Errorf(\"Oracle tnsnames.ora was not found in TNS_ADMIN directory: %s\", path)\n\t}\n\treturn tnsNamesPath, nil\n}\n\nfunc readOracleTNSAliases(path string, visited map[string]bool, depth int) (map[string]string, error) {\n\tif depth > 8 {\n\t\treturn nil, fmt.Errorf(\"Oracle TNS include depth exceeds 8 files\")\n\t}\n\tabsolutePath, err := filepath.Abs(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to resolve Oracle TNS file path: %w\", err)\n\t}\n\tif visited[absolutePath] {\n\t\treturn map[string]string{}, nil\n\t}\n\tvisited[absolutePath] = true\n\n\tfile, err := os.Open(absolutePath)","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/oracle-go/tns.go#L79-L115","documentation":"Once TNS_ADMIN is confirmed as an accessible directory, the driver stats <dir>/tnsnames.ora and requires it to exist and not be a directory. If the file is missing (or is itself a directory), resolution of any alias cannot proceed and this error is returned naming the TNS_ADMIN directory.","triggerScenarios":"resolveOracleTNSAlias -> oracleTNSNamesPath finds a valid TNS_ADMIN directory but tnsnames.ora is absent from it, or a directory named tnsnames.ora exists in its place.","commonSituations":"New TNS_ADMIN directory created but the tnsnames.ora never copied in; deployment pipelines mounting the directory without the file; file named tnsnames.ora.bak or TNSNAMES.ora on a case-sensitive filesystem; a directory accidentally named tnsnames.ora.","solutions":["Copy or create tnsnames.ora inside the TNS_ADMIN directory (exact lowercase spelling on case-sensitive filesystems).","Verify it is a regular file: ls -l $TNS_ADMIN/tnsnames.ora.","Fix deployment/backup tooling so the file is included in the mounted volume or image.","If aliases live in another file, point TNS_ADMIN at the directory that actually contains tnsnames.ora."],"exampleFix":"// before\n# /opt/oracle/network/admin contains only ldap.ora\n// after\ncp tnsnames.ora /opt/oracle/network/admin/tnsnames.ora","handlingStrategy":"validation","validationCode":"info, err := os.Stat(filepath.Join(tnsAdmin, \"tnsnames.ora\"))\nif err != nil || info.IsDir() {\n\treturn fmt.Errorf(\"tnsnames.ora missing in %s\", tnsAdmin)\n}","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"tnsnames.ora was not found\") {\n\treturn fmt.Errorf(\"deploy tnsnames.ora into the TNS_ADMIN directory: %w\", err)\n}","preventionTips":["Include tnsnames.ora in deployment artifacts/volumes that mount TNS_ADMIN.","Use exact lowercase filename on case-sensitive filesystems.","Smoke-test Oracle connectivity in CI with the real TNS_ADMIN contents.","Keep a checksum of tnsnames.ora to detect missing/stale files after deploys."],"tags":["oracle","tns","filesystem","config"],"backgroundTag":"file-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"}