{"record":{"id":"6afdaf05dda49bc6","repo":"shadow1ng/fscan","slug":"s-6afdaf","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/services/oracle_raw.go","lineNumber":1813,"sourceCode":"\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (s *oracleSession) hasError() bool {\n\treturn s.summary != nil && s.summary.retCode != 0 && s.summary.retCode != 1403\n}\n\nfunc (s *oracleSession) oracleError() error {\n\tif s.summary == nil {\n\t\treturn errors.New(\"oracle error\")\n\t}\n\tmsg := string(s.summary.errorMessage)\n\tif msg == \"\" {\n\t\tmsg = fmt.Sprintf(\"ORA-%05d\", s.summary.retCode)\n\t}\n\treturn fmt.Errorf(\"%s\", msg)\n}\n\nfunc oracleRefuseError(raw []byte) error {\n\tif len(raw) < 12 {\n\t\treturn errors.New(\"oracle connection refused\")\n\t}\n\tdataLen := int(binary.BigEndian.Uint16(raw[10:12]))\n\tif len(raw) < 12+dataLen {\n\t\treturn errors.New(\"oracle connection refused\")\n\t}\n\tmsg := string(raw[12 : 12+dataLen])\n\tcode := oracleExtractCode(msg)\n\tif code == 0 {\n\t\treturn fmt.Errorf(\"oracle connection refused: %s\", msg)\n\t}\n\treturn fmt.Errorf(\"ORA-%05d: %s\", code, msg)\n}\n","sourceCodeStart":1795,"sourceCodeEnd":1831,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/services/oracle_raw.go#L1795-L1831","documentation":"When the server returns an error packet, the library converts the summary's error message bytes into a Go error. If the server provided no message text, it synthesizes 'ORA-<retCode>'. This is the generic pass-through of server-side Oracle errors to the caller.","triggerScenarios":"Any TTC response carrying an error summary: readSummary populated retCode and optionally errorMessage; oracleError() formats it. The resulting error text is exactly the server's message (e.g. 'ORA-00942: table or view does not exist').","commonSituations":"SQL mistakes (bad table/column names, syntax errors), insufficient privileges (ORA-01031), constraint violations (ORA-00001), object not found — essentially every normal ORA- error surfaces through this path.","solutions":["Read the ORA- code in the message and address the specific database problem (fix SQL, grant privileges, resolve constraint).","Search the Oracle documentation for the ORA- code to understand the root cause.","If the message is the synthesized 'ORA-<code>' form, enable driver-level logging or check server alert.log for the full error text."],"exampleFix":"// before\n_, err := db.Exec(\"SELECT * FROM orderz\") // ORA-00942\n// after: validate identifiers/schema first\n_, err := db.Exec(\"SELECT * FROM orders\")","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, err := db.ExecContext(ctx, sql); err != nil {\n    var code int\n    if n, _ := fmt.Sscanf(err.Error(), \"ORA-%d\", &code); n == 1 {\n        switch code {\n        case 1: // unique constraint\n        case 942: // missing table\n        case 1017: // bad credentials\n        }\n    }\n}","preventionTips":["Parse ORA- codes out of the message for programmatic handling","Validate SQL schema/identifiers in tests against the real database","Grant least-privilege roles explicitly to the app user before deploys"],"tags":["oracle","server-error","ora-error","sql"],"backgroundTag":"database-query-failed","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}