{"record":{"id":"a24f64feb3f0e60a","repo":"t8y2/dbx","slug":"unsupported-h2-driver-profile-profile","errorCode":null,"errorMessage":"Unsupported H2 driver profile: \" + profile","messagePattern":"Unsupported H2 driver profile: \" \\+ profile","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agents/drivers/h2/src/main/java/com/dbx/agent/h2/H2DriverVersion.java","lineNumber":53,"sourceCode":"    }\n\n    int storageFormat() {\n        return storageFormat;\n    }\n\n    static H2DriverVersion select(ConnectParams params) throws Exception {\n        String profile = params.getDriver_profile();\n        String normalized = profile == null ? \"\" : profile.trim().toLowerCase(Locale.ROOT);\n        return switch (normalized) {\n            case \"h2-v1\" -> V1;\n            case \"h2-v2\", \"h2-legacy\" -> V2;\n            case \"h2-v3\" -> V3;\n            case \"h2-custom\" -> CUSTOM;\n            case \"\", \"h2\", \"h2-auto\", \"h2_embedded\", \"h2_server\" -> {\n                java.util.OptionalInt detected = H2FileFormatDetector.detect(H2Agent.buildUrl(params));\n                yield detected.isPresent() ? fromStorageFormat(detected.getAsInt()) : V3;\n            }\n            default -> throw new IllegalArgumentException(\"Unsupported H2 driver profile: \" + profile);\n        };\n    }\n\n    private static H2DriverVersion fromStorageFormat(int format) {\n        return switch (format) {\n            case 1 -> V1;\n            case 2 -> V2;\n            case 3 -> V3;\n            default -> throw new IllegalArgumentException(\"Unsupported H2 database file format: \" + format);\n        };\n    }\n}\n","sourceCodeStart":35,"sourceCodeEnd":66,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/h2/src/main/java/com/dbx/agent/h2/H2DriverVersion.java#L35-L66","documentation":"H2DriverVersion.select maps a named driver profile string to a driver version. Only a fixed set of names is recognized (h2-v1/h2-v2/h2-v3, h2-custom, and auto aliases). Any other string is rejected with IllegalArgumentException so typos never fall through to a wrong driver.","triggerScenarios":"Passing an unrecognized profile string (e.g. 'H2-V2', 'h2 2.x', 'h2-legacy') to select() via connection params/config.","commonSituations":"Typo or wrong casing in the profile config value; copied config from an older release whose profile names changed; invented profile name expecting a custom mapping.","solutions":["Use one of the supported profile names: h2-v1, h2-v2, h2-v3, h2-custom, or the auto aliases (\"\", h2, h2-auto, h2_embedded, h2_server)","Check spelling and casing of the configured profile value","If auto-detection is acceptable, set the profile to h2-auto and let the file-format detector choose"],"exampleFix":"// before\nparams.put(\"driverProfile\", \"h2-2.x\");\n// after\nparams.put(\"driverProfile\", \"h2-v3\");","handlingStrategy":"validation","validationCode":"Set<String> allowed = Set.of(\"\", \"h2\", \"h2-auto\", \"h2_embedded\", \"h2_server\", \"h2-v1\", \"h2-v2\", \"h2-v3\", \"h2-custom\");\nif (!allowed.contains(profile)) throw new IllegalArgumentException(\"bad profile: \" + profile);","typeGuard":null,"tryCatchPattern":"try {\n    H2DriverVersion v = H2DriverVersion.select(profile, params);\n} catch (IllegalArgumentException e) {\n    // report invalid config value with the allowed names\n}","preventionTips":["Centralize profile names as constants/enums instead of raw strings","Validate profile values when parsing config, before reaching the driver layer","Document the allowed profile names next to the config key"],"tags":["h2","configuration","illegal-argument","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}