You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "vanasys (via GitHub)" <gi...@apache.org> on 2026/04/17 01:45:04 UTC
[I] [Bug] REST API error response only contains top-level message, hiding root cause [seatunnel]
vanasys opened a new issue, #10781:
URL: https://github.com/apache/seatunnel/issues/10781
## [Bug] REST API error response only contains top-level message, hiding root cause
### Environment
- **SeaTunnel Version**: 2.3.13
- **Deployment Mode**: SeaTunnel Engine (Zeta) cluster
- **REST API Endpoint**: `POST /hazelcast/rest/maps/submit-job`
### Problem Description
When submitting a job via the REST API and the job fails during initialization, the returned JSON error response
only contains the **top-level exception message** (e.g., `Factory initialize failed`). The actual root cause — wh
ich is usually nested inside the `Caused by` chain — is **completely lost** in the HTTP response.
This makes remote debugging extremely difficult because callers of the REST API have no idea what really went wro
ng (e.g., missing required options, SQL syntax errors, connection timeouts, permission issues).
### Steps to Reproduce
1. Start SeaTunnel cluster.
2. Submit a deliberately broken job via REST API:
```bash
curl -X POST http://127.0.0.1:5802/hazelcast/rest/maps/submit-job \
-H "Content-Type: application/json" \
-d '{
"env": {"job.mode": "BATCH"},
"source": [{"FakeSource": {"row.num": 1}}],
"sink": [{"Doris": {"fenodes": "127.0.0.1:8030"}}]
}'
3. Observe the HTTP response:
{
"status": "fail",
"message": "Factory initialize failed"
}
4. Compare with the server log logs/seatunnel-engine-server.log, which contains the full Caused by stack trace.
Root Cause Analysis
In seatunnel-starter.jar, the class org.apache.seatunnel.engine.server.rest.filter.ExceptionHandlingFilter handle
s exceptions thrown during REST request processing.
Currently, in the handleException method, it only calls:
errResponse.setMessage(exception.getMessage());
It does not recursively traverse Throwable.getCause(), so all nested exception information is discarded before be
ing serialized back to the HTTP client.
Expected Behavior
The REST API should return the full error chain so that remote callers can understand the root cause without logg
ing into the server.
Expected response example:
{
"status": "fail",
"message": "Factory initialize failed | Caused by: OptionValidationException: the options('database') are requi
red."
}
Suggested Fix
Modify ExceptionHandlingFilter to build a full error message by recursively walking the exception chain:
private String buildFullErrorMessage(Throwable throwable) {
StringBuilder sb = new StringBuilder();
sb.append(throwable.getMessage());
Throwable cause = throwable.getCause();
while (cause != null) {
sb.append(" | Caused by: ")
.append(cause.getClass().getSimpleName())
.append(": ")
.append(cause.getMessage());
cause = cause.getCause();
}
return sb.toString().replace("\"", "'");
}
Then use buildFullErrorMessage(exception) instead of exception.getMessage() when constructing the error response.
Additional Context
• This issue affects all REST API clients that rely on the HTTP response for diagnostics.
• Server-side logs do contain the full stack trace, but in production environments, REST API users often do not h
e direct access to the server filesystem.
• I have verified that patching ExceptionHandlingFilter.class in seatunnel-starter.jar with the above logic resol
s the issue locally.
Are you willing to submit a PR?
• [ ] Yes I am willing to submit a PR!
---
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] REST API error response only contains top-level message, hiding root cause [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on issue #10781:
URL: https://github.com/apache/seatunnel/issues/10781#issuecomment-4264712235
Thanks for the detailed report.
I checked this against both `2.3.13` and the current `dev` branch. The behavior you described is valid for `2.3.13`: `ExceptionHandlingFilter#handleException` writes only `e.getMessage()` into the REST error response, so a wrapped initialization failure such as `Factory initialize failed` can hide the real nested cause from REST API callers.
This path appears to have already been improved on `dev` by PR #10696. In the current `dev` code, the same filter writes `ExceptionUtils.getStackTrace(e)` to the response message, so the nested `Caused by` chain should be visible to the REST caller as well as in the server log.
So I would treat this as already fixed in `dev`, but still affecting the released `2.3.13` package you tested.
Please verify with either:
1. a build from the current `dev` branch, or
2. the next release that contains PR #10696.
If the root cause is still hidden there, please update this issue with the exact REST response body and the corresponding server-side exception stack, and we can continue checking the remaining path. One follow-up worth considering separately is whether the REST response should expose a shorter structured error chain instead of the full stack trace, to keep diagnostics useful while avoiding accidental leakage of sensitive connection details.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] REST API error response only contains top-level message, hiding root cause [seatunnel]
Posted by "nielifeng (via GitHub)" <gi...@apache.org>.
nielifeng closed issue #10781: [Bug] REST API error response only contains top-level message, hiding root cause
URL: https://github.com/apache/seatunnel/issues/10781
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] REST API error response only contains top-level message, hiding root cause [seatunnel]
Posted by "nielifeng (via GitHub)" <gi...@apache.org>.
nielifeng commented on issue #10781:
URL: https://github.com/apache/seatunnel/issues/10781#issuecomment-5140133731
Verified this against a current `dev` deployment at commit `7e25769` (SeaTunnel `3.0.0-SNAPSHOT`, 3 Masters + 3 Workers).
I submitted a minimal invalid HOCON job through `POST /submit-job?format=hocon`: `FakeSource` had `row.num = 1` but intentionally omitted both `schema` and `tables_configs`.
Observed result:
- HTTP status: `500`
- response `status`: `fail`
- no `jobId` was created
- the response message contained the top-level `FactoryException` and the nested `Caused by: OptionValidationException`
- the nested message explicitly identified the missing `tables_configs` / `schema` exclusive-option constraint
Post-check: all three Masters reported commit `7e25769`, 3 Workers, 24/24 free slots, and 0 running/pending/failed jobs.
This confirms that the root cause is visible in the REST response on current `dev`, consistent with the `ExceptionUtils.getStackTrace(e)` change from #10696. I do not see a remaining dev regression for the behavior reported here; this issue looks ready to mark fixed-in-dev/close. The released 2.3.13 behavior remains the version-specific limitation described above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] REST API error response only contains top-level message, hiding root cause [seatunnel]
Posted by "vanasys (via GitHub)" <gi...@apache.org>.
vanasys commented on issue #10781:
URL: https://github.com/apache/seatunnel/issues/10781#issuecomment-4264821043
Thanks for the confirmation! Glad to see this already fixed in dev via PR #10696. I'll verify with the next release and update if anything is still missing.
Regarding the follow-up about structured error chain vs full stack trace — a shorter structured format (e.g., message + Caused by chain without full line numbers) would indeed be a good balance between diagnostics and security.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org