{"record":{"id":"29003c79d042c543","repo":"apple/pkl","slug":"invalid-test-reporter-input-valid-reporters","errorCode":null,"errorMessage":"Invalid test reporter: '${input}'. Valid reporters: '<each reporter name, lowercase>'.","messagePattern":"Invalid test reporter: '(.+?)'\\. Valid reporters: '<each reporter name, lowercase>'\\.","errorType":"validation","errorClass":"InvalidUserDataException","httpStatus":null,"severity":"error","filePath":"pkl-gradle/src/main/java/org/pkl/gradle/utils/PluginUtils.java","lineNumber":204,"sourceCode":"    try {\n      return TestReporter.valueOf(inputStr.toUpperCase(Locale.ROOT));\n    } catch (IllegalArgumentException e) {\n      var sb = new StringBuilder(\"Invalid test reporter: '\");\n      sb.append(inputStr).append(\"'. \");\n      sb.append(\"Valid reporters: \");\n      var isFirst = true;\n      // `enumEntries()` is not available in Kotlin versions below 1.8\n      //noinspection EnumValuesSoftDeprecateInJava\n      for (var value : TestReporter.values()) {\n        if (isFirst) {\n          isFirst = false;\n        } else {\n          sb.append(\", \");\n        }\n        sb.append('\\'').append(value.toString().toLowerCase(Locale.ROOT)).append('\\'');\n      }\n      sb.append(\".\");\n      throw new InvalidUserDataException(sb.toString());\n    }\n  }\n}\n","sourceCodeStart":186,"sourceCodeEnd":208,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-gradle/src/main/java/org/pkl/gradle/utils/PluginUtils.java#L186-L208","documentation":"toTestReporter converts a user-supplied test reporter name into a TestReporter enum value. If the input does not match any known reporter (case-insensitively), it throws InvalidUserDataException listing all valid reporter names in lowercase.","triggerScenarios":"Setting the testReports/test reporter property on Pkl Test tasks with a name not in the reporter enum (e.g. \"junitxml\" instead of \"junit-xml\" or whatever the enum defines).","commonSituations":"Typo in build.gradle testReporter setting, guessing reporter names, migrating CI configs from other tools (jest/mocha naming), or case/format mismatches.","solutions":["Use one of the exact reporter names listed in the error message (lowercase)","Check the plugin documentation or TestReporter enum for the valid set","Fix casing/typo in the reporter string in the build script","If a reporter seems missing, verify you are on a plugin version that supports it"],"exampleFix":"// before\ntestReporters = listOf(\"junit-xmlx\")\n// after\ntestReporters = listOf(\"junit-xml\")","handlingStrategy":"validation","validationCode":"// Java: validate against the enum before assignment\nboolean valid = java.util.Arrays.stream(TestReporter.values())\n    .anyMatch(r -> r.name().toLowerCase(java.util.Locale.ROOT).equals(input.toLowerCase(java.util.Locale.ROOT)));","typeGuard":null,"tryCatchPattern":"try {\n  task.getTestReporters().add(PluginUtils.toTestReporter(input));\n} catch (InvalidUserDataException e) {\n  logger.error(\"Invalid reporter '{}'; use one of: {}\", input, e.getMessage());\n  throw new GradleException(e.getMessage());\n}","preventionTips":["Copy reporter names from the error message's valid list verbatim","Check the TestReporter enum in the plugin version you use — names can change between versions","Keep reporter configuration in a shared convention plugin to avoid typos"],"tags":["gradle","invalid-enum","test-reporter","configuration"],"backgroundTag":"invalid-enum-value","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}