OpenAPITools/openapi-generator · error · RuntimeException
Failed to canonicalize file {testDataFileStr}
Error message
Failed to canonicalize file {testDataFileStr} What it means
Error "Failed to canonicalize file {testDataFileStr}" thrown in OpenAPITools/openapi-generator.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFExtServerCodegen.java:1338
if (generateOperationBody) {
boolean loadTestDataFromFile = convertPropertyToBooleanAndWriteBack(LOAD_TEST_DATA_FROM_FILE);
this.setLoadTestDataFromFile(loadTestDataFromFile);
if (loadTestDataFromFile) {
String testDataFileStr;
if (additionalProperties.containsKey(TEST_DATA_FILE))
testDataFileStr = (String) additionalProperties.get(TEST_DATA_FILE);
else
testDataFileStr = outputFolder() + "/src/main/resources/test-data.json";
testDataFileStr = testDataFileStr.replace('/', File.separatorChar);
try {
File testDataFile = new File(testDataFileStr).getCanonicalFile();
testDataFileStr = testDataFile.getPath();
additionalProperties.put(TEST_DATA_FILE, testDataFileStr.replaceAll("\\\\", "\\\\\\\\"));
setTestDataFile(testDataFile);
} catch (IOException e) {
throw new RuntimeException("Failed to canonicalize file " + testDataFileStr, e);
}
testDataCache = JsonCache.Factory.instance.get("test-data").mergePolicy(MergePolicy.KEEP_EXISTING)
.child('/' + invokerPackage);
if (this.testDataFile.exists()) {
try {
testDataCache.root().load(this.testDataFile);
} catch (CacheException e) {
LOGGER.error("Unable to load test data file " + testDataFileStr, e);
}
}
String testDataControlFileStr;
if (additionalProperties.containsKey(TEST_DATA_CONTROL_FILE))
testDataControlFileStr = (String) additionalProperties.get(TEST_DATA_CONTROL_FILE);
else
testDataControlFileStr = outputFolder() + "/test-data-control.json";
testDataControlFileStr = testDataControlFileStr.replace('/', File.separatorChar);View on GitHub (pinned to fcec517be3)
Solutions
- Check that the test data file path exists and is readable; verify the configured testDataFile location.
When it happens
Trigger: Thrown when the Java CXF-ext server generator cannot canonicalize the configured test data file path (invalid path or I/O error). Verify the testDataFile option points to an existing, readable file.
Common situations: See trigger scenarios.
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/70d9cbb98e715f6d.
Report an issue: GitHub.