cockroachdb/cockroach · error · Error

Failed to collect execution details

Error message

Failed to collect execution details

What it means

collectExecutionDetailsInJobProfilerApi invokes the crdb_internal.collect_execution_details(...) builtin through the internal SQL API. After the request succeeds at the transport level, it throws this generic error when the query returned no rows or the single row's req_resp column is false — meaning the builtin itself declined or failed to produce the execution-details bundle for the job.

Source

Thrown at pkg/ui/workspaces/cluster-ui/src/api/jobProfilerApi.ts:92

  };

  const req: SqlExecutionRequest = {
    execute: true,
    statements: [collectExecutionDetails],
    timeout: LONG_TIMEOUT,
  };

  return executeInternalSql<CollectExecutionDetailsResponse>(req).then(res => {
    // If request succeeded but query failed, throw error.
    if (res.error) {
      throw res.error;
    }

    if (
      res.execution?.txn_results[0]?.rows?.length === 0 ||
      res.execution?.txn_results[0]?.rows[0]["req_resp"] === false
    ) {
      throw new Error("Failed to collect execution details");
    }

    return res.execution.txn_results[0].rows[0];
  });
}

View on GitHub (pinned to 8812064a01)

Solutions

  1. Retry as an admin user to rule out privileges on the builtin
  2. Confirm the job is still in a running/retryable state on the Jobs page, then re-run collection
  3. Check server logs on the node executing the job — the builtin logs the concrete reason it returned false
  4. Verify the job type supports execution-detail collection at your cluster version

Example fix

// before
if (res.execution?.txn_results[0]?.rows?.length === 0 || res.execution?.txn_results[0]?.rows[0]['req_resp'] === false) {
  throw new Error('Failed to collect execution details');
}

// after: distinguish the two outcomes for actionable UX
const row = res.execution?.txn_results[0]?.rows?.[0];
if (!row) throw new Error('Failed to collect execution details: empty response');
if (row['req_resp'] === false) throw new Error('Failed to collect execution details: builtin rejected the request (check privileges and job state)');
Defensive patterns

Strategy: try-catch

Validate before calling

// Enable collection only for jobs that can produce a bundle
const canCollect = job.status === 'running' || job.status === 'retrying';
if (!canCollect) {
  return { disabled: true, reason: 'Job is not actively running' };
}

Type guard

const hasExecutionRows = (
  res: SqlExecutionResponse<CollectExecutionDetailsResponse>,
): boolean => !!res.execution?.txn_results?.[0]?.rows?.length;

Try / catch

try {
  await collectExecutionDetails(jobId);
  notifySuccess('Execution details collected');
} catch (e) {
  const msg = e instanceof Error ? e.message : '';
  if (msg === 'Failed to collect execution details') {
    notifyError('Collection failed — check privileges and that the job is still running');
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Clicking 'Collect execution details' in the job profiler when the builtin returns false: the console user lacks the required privilege (builtin is restricted, admin/MODIFYCLUSTERSETTING territory), or the job execution cannot be found on the target node (job paused, finished, or retried away).

Common situations: Non-admin operators trying to profile jobs; collecting details for a job that just transitioned state; RPC to the node running the job failing so no bundle files are written.

Related errors


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