googleapis/mcp-toolbox · error
failed to get job: %w
Error message
failed to get job: %w
What it means
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.
Source
Thrown at internal/sources/dataproc/dataproc.go:400
}
jobs = append(jobs, job)
}
return jobs, nil
}
// GetJob gets a single job.
func (s *Source) GetJob(ctx context.Context, jobId string) (any, error) {
client := s.GetJobControllerClient()
req := &dataprocpb.GetJobRequest{
ProjectId: s.Project,
Region: s.Region,
JobId: jobId,
}
jobPb, err := client.GetJob(ctx, req)
if err != nil {
return nil, fmt.Errorf("failed to get job: %w", err)
}
jsonBytes, err := protojson.Marshal(jobPb)
if err != nil {
return nil, fmt.Errorf("failed to marshal job to JSON: %w", err)
}
var result map[string]any
if err := json.Unmarshal(jsonBytes, &result); err != nil {
return nil, fmt.Errorf("failed to unmarshal job JSON: %w", err)
}
consoleUrl := JobConsoleURLFromProto(jobPb, s.Region)
logsUrl, err := JobLogsURLFromProto(jobPb, s.Region)
if err != nil {
return nil, fmt.Errorf("error generating logs url: %v", err)
}
View on GitHub (pinned to 8cc6e09de2)
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
Example fix
// before
job, err := toolbox.GetJob(ctx, jobId)
// after
job, err := toolbox.GetJob(ctx, jobId)
if err != nil && strings.Contains(err.Error(), "not found") {
// job expired or wrong ID/region; handle explicitly
} Defensive patterns
Strategy: try-catch
Validate before calling
if jobId == "" {
return fmt.Errorf("jobId is required")
}
if region == "" {
return fmt.Errorf("region is required")
} Try / catch
job, err := svc.GetJob(ctx, jobId)
if err != nil {
if strings.Contains(err.Error(), "NotFound") {
return fmt.Errorf("job %s not found in region %s (may have expired)", jobId, region)
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed to list jobs: %w
- error cloning instance: %w
- error creating database: %w
- error creating user: %w
- error getting instance: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/90c932f81695b99d.
Report an issue: GitHub.