{"record":{"id":"9c723200adafaf40","repo":"t8y2/dbx","slug":"scheduler-jobs-must-be-read-from-the-scheduler-job","errorCode":null,"errorMessage":"scheduler jobs must be read from the scheduler job scope","messagePattern":"scheduler jobs must be read from the scheduler job scope","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/xugu/main.go","lineNumber":3217,"sourceCode":"\tBeginTime      any\n\tRepeatInterval any\n\tEndTime        any\n\tEnabled        any\n\tAutoDrop       any\n\tComments       any\n}\n\nconst xuguCatalogSchedulerJobNameSelectSQL = `\nSELECT JOB_NAME\nFROM ALL_JOBS\nWHERE DB_ID = CURRENT_DB_ID`\n\n// getSchedulerJobSource reconstructs a replayable DBMS_SCHEDULER.CREATE_JOB\n// call from the catalog. Xugu stores jobs at database scope rather than under\n// a schema, so the returned synthetic scope is retained for sidebar routing.\nfunc (s *server) getSchedulerJobSource(schema, name string) (map[string]any, error) {\n\tif !isXuguSchedulerJobScope(schema) {\n\t\treturn nil, errors.New(\"scheduler jobs must be read from the scheduler job scope\")\n\t}\n\tjobName, err := s.resolveCatalogSchedulerJobName(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trows, err := s.queryRows(xuguSchedulerJobMetadataQuery(jobName), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer s.closeRows(rows)\n\n\tresult := map[string]any{\n\t\t\"name\":        jobName,\n\t\t\"object_type\": \"JOB\",\n\t\t\"schema\":      xuguSchedulerJobScope,\n\t\t\"source\":      \"\",\n\t\t\"editable\":    false,\n\t}","sourceCodeStart":3199,"sourceCodeEnd":3235,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/xugu/main.go#L3199-L3235","documentation":"getSchedulerJobSource reconstructs a replayable DBMS_SCHEDULER.CREATE_JOB call, but Xugu stores scheduler jobs at database scope rather than under a schema. The function therefore requires the synthetic scheduler-job scope and rejects any other schema value with this error.","triggerScenarios":"Calling the scheduler-job source/metadata RPC with a schema that fails isXuguSchedulerJobScope(schema) — e.g. passing a real schema name, an empty schema, or the default scope instead of the special scheduler job scope.","commonSituations":"Clients treating scheduler jobs like schema-scoped objects and passing the job's apparent schema; stale sidebar routing after the agent changed scope conventions; hardcoding a schema instead of using the synthetic scope returned by job listings.","solutions":["Pass the synthetic scheduler job scope (as returned when jobs are listed) as the schema parameter","Route scheduler-job requests through the scheduler job sidebar scope, not a database schema","Update client code that assumes jobs are schema-scoped"],"exampleFix":"// before\nagent.GetSchedulerJobSource(ctx, \"public\", jobName)\n// after\nscope := schedulerJobScope() // synthetic scope from job listing\nagent.GetSchedulerJobSource(ctx, scope, jobName)","handlingStrategy":"validation","validationCode":"if !isXuguSchedulerJobScope(schema) { return errors.New(\"use the scheduler job scope\") }","typeGuard":"func isSchedulerScope(schema string) bool { return schema == schedulerJobScopeValue }","tryCatchPattern":"src, err := agent.GetSchedulerJobSource(ctx, schema, name)\nif err != nil && strings.Contains(err.Error(), \"scheduler job scope\") { return ErrInvalidSchedulerScope }","preventionTips":["Use the synthetic scope returned by scheduler job listings","Never treat scheduler jobs as schema-scoped objects on Xugu","Keep sidebar routing in sync with the agent's scope conventions"],"tags":["validation","scope","scheduler"],"backgroundTag":"invalid-object-scope","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}