{"record":{"id":"893171ad7756f094","repo":"t8y2/dbx","slug":"sql-is-required-893171","errorCode":null,"errorMessage":"sql is required","messagePattern":"sql is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/oracle-go/main.go","lineNumber":3534,"sourceCode":"\tcase \"C\":\n\t\treturn \"CHAR\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}\n\nfunc isOracleCharacterType(dataType string) bool {\n\tswitch dataType {\n\tcase \"CHAR\", \"VARCHAR2\", \"VARCHAR\", \"NCHAR\", \"NVARCHAR2\", \"RAW\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\nfunc (s *server) getExplainInfo(sqlText, database, schema string, timeoutSecs int) (string, error) {\n\tif strings.TrimSpace(sqlText) == \"\" {\n\t\treturn \"\", errors.New(\"sql is required\")\n\t}\n\tdb, err := s.requireDB()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tctx := context.Background()\n\tvar cancel context.CancelFunc\n\tif timeoutSecs > 0 {\n\t\tctx, cancel = context.WithTimeout(ctx, time.Duration(timeoutSecs)*time.Second)\n\t} else {\n\t\tctx, cancel = context.WithCancel(ctx)\n\t}\n\tdefer cancel()\n\n\tconn, err := db.Conn(ctx)\n\tif err != nil {\n\t\treturn \"\", err","sourceCodeStart":3516,"sourceCodeEnd":3552,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/oracle-go/main.go#L3516-L3552","documentation":"getExplainInfo validates that the SQL text parameter is non-empty (after trimming whitespace) before doing any work, returning this error for blank input. An EXPLAIN PLAN with no statement is meaningless, so the agent fails fast with a clear validation message instead of sending an invalid request to Oracle.","triggerScenarios":"Calling the explain RPC with an empty string, a string of only spaces/tabs/newlines, or a missing/undefined sql parameter that decodes to \"\".","commonSituations":"A template/variable interpolation that produced an empty query; request builders dropping an optional field; passing the wrong variable (e.g. an empty schema) into the sql slot.","solutions":["Pass the actual SQL statement in the sql parameter","Trim-validate the SQL client-side before calling and return a clearer local error","Fix interpolation/templating so the statement is not empty","Confirm the correct field name is used when building the RPC params"],"exampleFix":"// before\nawait driver.explain({ sql: sqlText }) // sqlText may be \"\"\n// after\nif (!sqlText || !sqlText.trim()) {\n  throw new Error(\"explain: sql must be a non-empty statement\")\n}\nawait driver.explain({ sql: sqlText })","handlingStrategy":"validation","validationCode":"if (typeof sql !== 'string' || sql.trim() === '') {\n  throw new Error('getExplainInfo: sql must be a non-empty statement')\n}","typeGuard":"function isValidSqlText(v) {\n  return typeof v === 'string' && v.trim().length > 0\n}","tryCatchPattern":null,"preventionTips":["Validate all required RPC params at the client boundary before sending","Check template/interpolation output for empty values in tests","Assert the variable passed as sql is actually the statement, not another field","Fail fast locally with a descriptive error rather than relying on the agent's generic message"],"tags":["oracle","validation","input-error"],"backgroundTag":"missing-required-parameter","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"}