shadow1ng/fscan · error

%s

Error message

%s

What it means

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.

Source

Thrown at plugins/services/oracle_raw.go:1813

			return err
		}
	}
	return nil
}

func (s *oracleSession) hasError() bool {
	return s.summary != nil && s.summary.retCode != 0 && s.summary.retCode != 1403
}

func (s *oracleSession) oracleError() error {
	if s.summary == nil {
		return errors.New("oracle error")
	}
	msg := string(s.summary.errorMessage)
	if msg == "" {
		msg = fmt.Sprintf("ORA-%05d", s.summary.retCode)
	}
	return fmt.Errorf("%s", msg)
}

func oracleRefuseError(raw []byte) error {
	if len(raw) < 12 {
		return errors.New("oracle connection refused")
	}
	dataLen := int(binary.BigEndian.Uint16(raw[10:12]))
	if len(raw) < 12+dataLen {
		return errors.New("oracle connection refused")
	}
	msg := string(raw[12 : 12+dataLen])
	code := oracleExtractCode(msg)
	if code == 0 {
		return fmt.Errorf("oracle connection refused: %s", msg)
	}
	return fmt.Errorf("ORA-%05d: %s", code, msg)
}

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Read the ORA- code in the message and address the specific database problem (fix SQL, grant privileges, resolve constraint).
  2. Search the Oracle documentation for the ORA- code to understand the root cause.
  3. If the message is the synthesized 'ORA-<code>' form, enable driver-level logging or check server alert.log for the full error text.

Example fix

// before
_, err := db.Exec("SELECT * FROM orderz") // ORA-00942
// after: validate identifiers/schema first
_, err := db.Exec("SELECT * FROM orders")
Defensive patterns

Strategy: try-catch

Try / catch

if _, err := db.ExecContext(ctx, sql); err != nil {
    var code int
    if n, _ := fmt.Sscanf(err.Error(), "ORA-%d", &code); n == 1 {
        switch code {
        case 1: // unique constraint
        case 942: // missing table
        case 1017: // bad credentials
        }
    }
}

Prevention

When it happens

Trigger: 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').

Common situations: 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.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06). Data as JSON: /api/errors/6afdaf05dda49bc6. Report an issue: GitHub.