testcontainers/testcontainers-java · error · UncategorizedScriptException
${e.getMessage()}
Error message
${e.getMessage()} What it means
The same execute() flow in YugabyteDBYCQLDelegate catches any Exception during statement execution, logs it at debug level, and rethrows it as Spring's UncategorizedScriptException with the original message. It classifies script execution failures that are not the explicit non-zero-exit-code path.
Solutions
- Enable debug logging for the delegate to see the original stack trace (log.debug only)
- Fix the root cause shown in the wrapped message
- Ensure the container is running and healthy before init scripts execute
- Check that script statements are valid and semicolon-joined
Defensive patterns
Strategy: try-catch
Validate before calling
assert container.isRunning() : "yugabytedb container must be started before executing scripts";
Try / catch
catch (UncategorizedScriptException e) { /* original message is e.getCause().getMessage(); enable debug logging for the delegate */ } Prevention
- Enable debug logging for org.testcontainers to see the original exception
- Start the container before any delegate execution
- Keep scripts idempotent and syntactically valid
When it happens
Trigger: Any Exception thrown while preparing/running the ycqlsh ExecScript (e.g. container not running, exec failures), after which the catch block wraps e.getMessage() in UncategorizedScriptException.
Common situations: Container stopped before init; exec API failures; combined with 241 — the RuntimeException from non-zero exit is itself re-wrapped here as UncategorizedScriptException.
Understand the failure class
Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.
Related errors
- ${result.getStderr()}
- Error while executing init script
- Script execution failed
- Error while executing init script
- Script statement failed at line lineNumber in script…
AI-assisted analysis of testcontainers/testcontainers-java@8e549514e3 (2026-09-12).
Data as JSON: /api/errors/73aba5824dbb3982.
Report an issue: GitHub.
Appendix: source
Thrown at modules/yugabytedb/src/main/java/org/testcontainers/containers/delegate/YugabyteDBYCQLDelegate.java:64
try {
ExecResult result = container.execInContainer(
BIN_PATH,
containerInterfaceIP,
"-u",
container.getUsername(),
"-p",
container.getPassword(),
"-k",
container.getKeyspace(),
"-e",
StringUtils.join(statements, ";")
);
if (result.getExitCode() != 0) {
throw new RuntimeException(result.getStderr());
}
} catch (Exception e) {
log.debug(e.getMessage(), e);
throw new UncategorizedScriptException(e.getMessage(), e);
}
}
}
View on GitHub (pinned to 8e549514e3)