{"record":{"id":"207aab0324c49e3c","repo":"cockroachdb/cockroach","slug":"failed-to-collect-execution-details","errorCode":null,"errorMessage":"Failed to collect execution details","messagePattern":"Failed to collect execution details","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"pkg/ui/workspaces/cluster-ui/src/api/jobProfilerApi.ts","lineNumber":92,"sourceCode":"  };\n\n  const req: SqlExecutionRequest = {\n    execute: true,\n    statements: [collectExecutionDetails],\n    timeout: LONG_TIMEOUT,\n  };\n\n  return executeInternalSql<CollectExecutionDetailsResponse>(req).then(res => {\n    // If request succeeded but query failed, throw error.\n    if (res.error) {\n      throw res.error;\n    }\n\n    if (\n      res.execution?.txn_results[0]?.rows?.length === 0 ||\n      res.execution?.txn_results[0]?.rows[0][\"req_resp\"] === false\n    ) {\n      throw new Error(\"Failed to collect execution details\");\n    }\n\n    return res.execution.txn_results[0].rows[0];\n  });\n}\n","sourceCodeStart":74,"sourceCodeEnd":98,"githubUrl":"https://github.com/cockroachdb/cockroach/blob/8812064a015d2faf99d3fc7e15880f94042954b0/pkg/ui/workspaces/cluster-ui/src/api/jobProfilerApi.ts#L74-L98","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Retry as an admin user to rule out privileges on the builtin","Confirm the job is still in a running/retryable state on the Jobs page, then re-run collection","Check server logs on the node executing the job — the builtin logs the concrete reason it returned false","Verify the job type supports execution-detail collection at your cluster version"],"exampleFix":"// before\nif (res.execution?.txn_results[0]?.rows?.length === 0 || res.execution?.txn_results[0]?.rows[0]['req_resp'] === false) {\n  throw new Error('Failed to collect execution details');\n}\n\n// after: distinguish the two outcomes for actionable UX\nconst row = res.execution?.txn_results[0]?.rows?.[0];\nif (!row) throw new Error('Failed to collect execution details: empty response');\nif (row['req_resp'] === false) throw new Error('Failed to collect execution details: builtin rejected the request (check privileges and job state)');","handlingStrategy":"try-catch","validationCode":"// Enable collection only for jobs that can produce a bundle\nconst canCollect = job.status === 'running' || job.status === 'retrying';\nif (!canCollect) {\n  return { disabled: true, reason: 'Job is not actively running' };\n}","typeGuard":"const hasExecutionRows = (\n  res: SqlExecutionResponse<CollectExecutionDetailsResponse>,\n): boolean => !!res.execution?.txn_results?.[0]?.rows?.length;","tryCatchPattern":"try {\n  await collectExecutionDetails(jobId);\n  notifySuccess('Execution details collected');\n} catch (e) {\n  const msg = e instanceof Error ? e.message : '';\n  if (msg === 'Failed to collect execution details') {\n    notifyError('Collection failed — check privileges and that the job is still running');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Gate the collect button on job state (running/retrying) and user privileges","Treat the builtin's false return as expected: surface an actionable message, not a stack trace","Check server logs on the node running the job when collection repeatedly fails"],"tags":["cluster-ui","job-profiler","sql-api","permissions","typescript"],"backgroundTag":null,"analyzedSha":"8812064a015d2faf99d3fc7e15880f94042954b0","analyzedAt":"2026-08-15T16:34:17.351Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}