{"record":{"id":"90c932f81695b99d","repo":"googleapis/mcp-toolbox","slug":"failed-to-get-job-w","errorCode":null,"errorMessage":"failed to get job: %w","messagePattern":"failed to get job: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/dataproc/dataproc.go","lineNumber":400,"sourceCode":"\t\t}\n\t\tjobs = append(jobs, job)\n\t}\n\treturn jobs, nil\n}\n\n// GetJob gets a single job.\nfunc (s *Source) GetJob(ctx context.Context, jobId string) (any, error) {\n\tclient := s.GetJobControllerClient()\n\n\treq := &dataprocpb.GetJobRequest{\n\t\tProjectId: s.Project,\n\t\tRegion:    s.Region,\n\t\tJobId:     jobId,\n\t}\n\n\tjobPb, err := client.GetJob(ctx, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get job: %w\", err)\n\t}\n\n\tjsonBytes, err := protojson.Marshal(jobPb)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal job to JSON: %w\", err)\n\t}\n\n\tvar result map[string]any\n\tif err := json.Unmarshal(jsonBytes, &result); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal job JSON: %w\", err)\n\t}\n\n\tconsoleUrl := JobConsoleURLFromProto(jobPb, s.Region)\n\tlogsUrl, err := JobLogsURLFromProto(jobPb, s.Region)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error generating logs url: %v\", err)\n\t}\n","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/dataproc/dataproc.go#L382-L418","documentation":"GetJob wraps any error from the Dataproc client's GetJob RPC with %w. It means the API call to fetch a single job by ID in the configured region failed, preserving the underlying gRPC/API error for inspection.","triggerScenarios":"Calling GetJob with a jobId that does not exist, a wrong region (job lives elsewhere), insufficient IAM permissions (dataproc.jobs.get), or any network/API failure.","commonSituations":"Typo in job ID (Dataproc job IDs are UUIDs or user-supplied IDs), job already deleted (jobs auto-expire), region mismatch between where the job was submitted and the source config, missing roles/dataproc.viewer.","solutions":["Unwrap the error to read the gRPC status code (NotFound, PermissionDenied, etc.)","Verify the jobId is correct and hasn't expired (Dataproc retains jobs for a limited retention period)","Confirm the region in the source config matches the job's region","Grant dataproc.jobs.get permission to the caller's identity"],"exampleFix":"// before\njob, err := toolbox.GetJob(ctx, jobId)\n// after\njob, err := toolbox.GetJob(ctx, jobId)\nif err != nil && strings.Contains(err.Error(), \"not found\") {\n\t// job expired or wrong ID/region; handle explicitly\n}","handlingStrategy":"try-catch","validationCode":"if jobId == \"\" {\n\treturn fmt.Errorf(\"jobId is required\")\n}\nif region == \"\" {\n\treturn fmt.Errorf(\"region is required\")\n}","typeGuard":null,"tryCatchPattern":"job, err := svc.GetJob(ctx, jobId)\nif err != nil {\n\tif strings.Contains(err.Error(), \"NotFound\") {\n\t\treturn fmt.Errorf(\"job %s not found in region %s (may have expired)\", jobId, region)\n\t}\n\treturn err\n}","preventionTips":["Store job IDs and their region together when the job is submitted","Remember Dataproc jobs auto-expire; fetch promptly","Verify IAM includes dataproc.jobs.get"],"tags":["gcp","dataproc","api-error","wrapped-error"],"backgroundTag":"gcp-api-request-failed","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}