Skip to content

Core: Propagate server error message in failed remote scan planning responses#16024

Open
singhpk234 wants to merge 2 commits intoapache:mainfrom
singhpk234:fix/propagate-server-error-in-failed-scan-planning
Open

Core: Propagate server error message in failed remote scan planning responses#16024
singhpk234 wants to merge 2 commits intoapache:mainfrom
singhpk234:fix/propagate-server-error-in-failed-scan-planning

Conversation

@singhpk234
Copy link
Copy Markdown
Contributor

@singhpk234 singhpk234 commented Apr 18, 2026

Per the OpenAPI spec, FailedPlanningResult extends IcebergErrorResponse via allOf — when server-side scan planning fails, the response is an HTTP 200 with status: "failed" and a

FailedPlanningResult:
type: object
description: Failed server-side planning result
allOf:
- $ref: '#/components/schemas/IcebergErrorResponse'
- type: object
required:
- status
properties:
status:
$ref: '#/components/schemas/PlanStatus'
const: "failed"

full ErrorModel (message, type, code) in the body:

  {
    "status": "failed",
    "error": {
      "message": "I am on fire",
      "type": "IllegalStateException",
      "code": 500
    }
  }

Currently the SDK discards this error information entirely. RESTTableScan throws a generic IllegalStateException like:

Invalid planStatus: failed for planId: 6594660417062534

After this change, the server's error message is surfaced:

Received status: failed for planId: 6594660417062534. Server error: I am on fire
Changes

  • Add ErrorResponse errorResponse field to FetchPlanningResultResponse and PlanTableScanResponse with an errorMessage() convenience accessor
  • Parse the error object via existing ErrorResponseParser in both FetchPlanningResultResponseParser and PlanTableScanResponseParser
  • Serialize the error as a spec-compliant ErrorModel (message, type, code) in toJson
  • Extract ErrorResponseParser.writeErrorField() to avoid duplicating serialization logic across parsers
  • Include the server error message in exceptions thrown by RESTTableScan for both planTableScan and fetchPlanningResult code paths

used ai to generate the pr

@singhpk234 singhpk234 requested review from amogh-jahagirdar and nastra and removed request for amogh-jahagirdar April 18, 2026 00:46
@github-actions github-actions bot added the core label Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants