{"record":{"id":"86f3adc4eb401eb5","repo":"cockroachdb/cockroach","slug":"no-schedule-found-with-this-id","errorCode":null,"errorMessage":"No schedule found with this ID.","messagePattern":"No schedule found with this ID\\.","errorType":"http","errorClass":"RequestError","httpStatus":400,"severity":"error","filePath":"pkg/ui/workspaces/cluster-ui/src/api/schedulesApi.ts","lineNumber":128,"sourceCode":"        // may also be truncated.\n        sql: `\n          WITH schedules AS (SHOW SCHEDULES)\n          SELECT id::string, label, schedule_status, next_run,\n                 state, recurrence, jobsrunning, owner,\n                 created, jsonb_pretty(command) as command\n          FROM schedules\n          WHERE ID = $1::int64\n        `,\n        arguments: [id.toString()],\n      },\n    ],\n    execute: true,\n  };\n  return executeInternalSql<ScheduleColumns>(request).then(result => {\n    const txnResults = result.execution.txn_results;\n    if (txnResults.length === 0 || !txnResults[0].rows) {\n      // No data.\n      throw new RequestError(400, \"No schedule found with this ID.\");\n    }\n\n    if (txnResults[0].rows.length > 1) {\n      throw new RequestError(500, \"Multiple schedules found for ID.\");\n    }\n    const row = txnResults[0].rows[0];\n    return {\n      id: Long.fromString(row.id),\n      label: row.label,\n      status: row.schedule_status,\n      nextRun: row.next_run ? moment.utc(row.next_run) : null,\n      state: row.state,\n      recurrence: row.recurrence,\n      jobsRunning: row.jobsrunning,\n      owner: row.owner,\n      created: moment.utc(row.created),\n      command: row.command,\n    };","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/cockroachdb/cockroach/blob/8812064a015d2faf99d3fc7e15880f94042954b0/pkg/ui/workspaces/cluster-ui/src/api/schedulesApi.ts#L110-L146","documentation":"getSchedule in schedulesApi queries system.schedules WHERE ID = $1::int64 through the internal SQL API and throws RequestError(400, 'No schedule found with this ID.') when the response has no txn results or no rows. It is the domain-level not-found signal for the schedules detail endpoint — the id simply does not exist in system.schedules.","triggerScenarios":"Fetching schedule details for an id that is absent from system.schedules: the schedule was dropped while the details page was open, a stale link/bookmark points at a deleted schedule, or the caller mangled the id (e.g. wrong Long conversion).","commonSituations":"Schedules UI opened from an old bookmark; backup/schedule deleted by another session or by its own expiration between list and detail load; scripts hitting the endpoint with hardcoded ids after a cluster wipe.","solutions":["Verify existence directly: SELECT id, label, schedule_status FROM system.schedules WHERE id = <id>","Refresh the schedules list and re-select — the row may have been dropped while the page was open","Handle the 400 as not-found in the caller: show an empty state and navigate back to the list"],"exampleFix":"// before\ngetTableMetadataApiScheduleDetails(id).catch(err => setError(err));\n\n// after: treat the 400 as not-found\nimport { RequestError } from 'src/api/requestError';\ntry {\n  const schedule = await getSchedule(id);\n} catch (e) {\n  if (e instanceof RequestError && e.status === 400) {\n    return <EmptyState title='Schedule not found' />;\n  }\n  throw e;\n}","handlingStrategy":"validation","validationCode":"// Pre-check existence when the id may be stale (e.g. deep links)\nconst exists = await executeInternalSql<ScheduleColumns>({\n  statements: [{ sql: 'SELECT 1 FROM system.schedules WHERE id = $1::int64', arguments: [String(id)] }],\n  execute: true,\n});\nif (!exists.execution.txn_results[0]?.rows?.length) {\n  return <Navigate to='/schedules' replace />;\n}","typeGuard":"const isRequestError = (\n  e: unknown,\n  status?: number,\n): e is RequestError =>\n  e instanceof RequestError && (status === undefined || e.status === status);","tryCatchPattern":"import { RequestError } from 'src/api/requestError';\ntry {\n  const schedule = await getSchedule(id);\n} catch (e) {\n  if (isRequestError(e, 400)) {\n    return <EmptyState title='Schedule not found' />; // expected domain case\n  }\n  throw e;\n}","preventionTips":["Refresh list data before acting on ids from stale pages","Treat 400 from this endpoint as not-found in UI handling, not as a bug","Never hardcode schedule ids in scripts against recreated clusters"],"tags":["cluster-ui","schedules","sql-api","not-found","typescript"],"backgroundTag":null,"analyzedSha":"8812064a015d2faf99d3fc7e15880f94042954b0","analyzedAt":"2026-08-15T16:34:17.351Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}