cockroachdb/cockroach · error · RequestError

No schedule found with this ID.

Error message

No schedule found with this ID.

What it means

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.

Source

Thrown at pkg/ui/workspaces/cluster-ui/src/api/schedulesApi.ts:128

        // may also be truncated.
        sql: `
          WITH schedules AS (SHOW SCHEDULES)
          SELECT id::string, label, schedule_status, next_run,
                 state, recurrence, jobsrunning, owner,
                 created, jsonb_pretty(command) as command
          FROM schedules
          WHERE ID = $1::int64
        `,
        arguments: [id.toString()],
      },
    ],
    execute: true,
  };
  return executeInternalSql<ScheduleColumns>(request).then(result => {
    const txnResults = result.execution.txn_results;
    if (txnResults.length === 0 || !txnResults[0].rows) {
      // No data.
      throw new RequestError(400, "No schedule found with this ID.");
    }

    if (txnResults[0].rows.length > 1) {
      throw new RequestError(500, "Multiple schedules found for ID.");
    }
    const row = txnResults[0].rows[0];
    return {
      id: Long.fromString(row.id),
      label: row.label,
      status: row.schedule_status,
      nextRun: row.next_run ? moment.utc(row.next_run) : null,
      state: row.state,
      recurrence: row.recurrence,
      jobsRunning: row.jobsrunning,
      owner: row.owner,
      created: moment.utc(row.created),
      command: row.command,
    };

View on GitHub (pinned to 8812064a01)

Solutions

  1. Verify existence directly: SELECT id, label, schedule_status FROM system.schedules WHERE id = <id>
  2. Refresh the schedules list and re-select — the row may have been dropped while the page was open
  3. Handle the 400 as not-found in the caller: show an empty state and navigate back to the list

Example fix

// before
getTableMetadataApiScheduleDetails(id).catch(err => setError(err));

// after: treat the 400 as not-found
import { RequestError } from 'src/api/requestError';
try {
  const schedule = await getSchedule(id);
} catch (e) {
  if (e instanceof RequestError && e.status === 400) {
    return <EmptyState title='Schedule not found' />;
  }
  throw e;
}
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check existence when the id may be stale (e.g. deep links)
const exists = await executeInternalSql<ScheduleColumns>({
  statements: [{ sql: 'SELECT 1 FROM system.schedules WHERE id = $1::int64', arguments: [String(id)] }],
  execute: true,
});
if (!exists.execution.txn_results[0]?.rows?.length) {
  return <Navigate to='/schedules' replace />;
}

Type guard

const isRequestError = (
  e: unknown,
  status?: number,
): e is RequestError =>
  e instanceof RequestError && (status === undefined || e.status === status);

Try / catch

import { RequestError } from 'src/api/requestError';
try {
  const schedule = await getSchedule(id);
} catch (e) {
  if (isRequestError(e, 400)) {
    return <EmptyState title='Schedule not found' />; // expected domain case
  }
  throw e;
}

Prevention

When it happens

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

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

Related errors


AI-assisted analysis of cockroachdb/cockroach@8812064a01 (2026-08-15). Data as JSON: /api/errors/86f3adc4eb401eb5. Report an issue: GitHub.