{"record":{"id":"caa82bbc0142ea63","repo":"appsmithorg/appsmith","slug":"pe-arg-5000-caa82b","errorCode":"PE-ARG-5000","errorMessage":"Unsupported feature: ${feature}","messagePattern":"Unsupported feature: (.+?)","errorType":"exception","errorClass":"AppsmithPluginException","httpStatus":500,"severity":"error","filePath":"app/server/appsmith-plugins/appsmithAiPlugin/src/main/java/com/external/plugins/services/AiFeatureServiceFactory.java","lineNumber":39,"sourceCode":"                return new TextClassificationServiceImpl();\n            }\n            case TEXT_SUMMARY -> {\n                return new TextSummarizationServiceImpl();\n            }\n            case TEXT_ENTITY_EXTRACT -> {\n                return new TextEntityExtractionServiceImpl();\n            }\n            case IMAGE_CLASSIFY -> {\n                return new ImageClassificationServiceImpl();\n            }\n            case IMAGE_ENTITY_EXTRACT -> {\n                return new ImageEntityExtractionServiceImpl();\n            }\n            case IMAGE_CAPTION -> {\n                return new ImageCaptioningServiceImpl();\n            }\n        }\n        throw new AppsmithPluginException(\n                AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, \"Unsupported feature: \" + feature);\n    }\n}\n","sourceCodeStart":21,"sourceCodeEnd":43,"githubUrl":"https://github.com/appsmithorg/appsmith/blob/8cd9021c24cdbea1c3c12c966073708e83db60c2/app/server/appsmith-plugins/appsmithAiPlugin/src/main/java/com/external/plugins/services/AiFeatureServiceFactory.java#L21-L43","documentation":"Thrown by AiFeatureServiceFactory.getAiFeatureService when the Feature enum switch has no matching case. The switch covers TEXT_GENERATE, TEXT_CLASSIFY, TEXT_SUMMARY, TEXT_ENTITY_EXTRACT, IMAGE_CLASSIFY, IMAGE_ENTITY_EXTRACT, IMAGE_CAPTION; any other value (or a future enum constant added without a case) hits the default throw. Code PE-ARG-5000.","triggerScenarios":"Calling getAiFeatureService with a Feature value not handled by the switch — e.g. null (would NPE in switch instead), or a newly added enum constant the factory wasn't updated to support.","commonSituations":"A new Feature variant is introduced in the enum but the factory switch is not updated; a caller passes an unexpected/custom feature; deserialization yields an unmapped feature value.","solutions":["Confirm the requested Feature is one of the seven supported values.","If you added a new Feature enum constant, add a corresponding case to the factory switch.","Validate the feature value against the supported set before calling the factory."],"exampleFix":"// before: factory has no case for the new constant\n//   case UNSENT_FEATURE -> ...\n// after: add the case\nswitch (feature) {\n    // ...existing cases...\n    case NEW_FEATURE -> { return new NewFeatureServiceImpl(); }\n}","handlingStrategy":"validation","validationCode":"// Confirm feature is supported before invoking the factory\nSet<Feature> supported = EnumSet.of(\n    Feature.TEXT_GENERATE, Feature.TEXT_CLASSIFY, Feature.TEXT_SUMMARY,\n    Feature.TEXT_ENTITY_EXTRACT, Feature.IMAGE_CLASSIFY,\n    Feature.IMAGE_ENTITY_EXTRACT, Feature.IMAGE_CAPTION);\nif (!supported.contains(feature)) {\n    return errorResult(\"Unsupported feature: \" + feature);\n}","typeGuard":"boolean isSupportedFeature(Feature f) {\n    return switch (f) {\n        case TEXT_GENERATE, TEXT_CLASSIFY, TEXT_SUMMARY, TEXT_ENTITY_EXTRACT,\n             IMAGE_CLASSIFY, IMAGE_ENTITY_EXTRACT, IMAGE_CAPTION -> true;\n        default -> false;\n    };\n}","tryCatchPattern":"try {\n    AiFeatureService svc = AiFeatureServiceFactory.getAiFeatureService(feature);\n} catch (AppsmithPluginException e) {\n    if (e.getMessage().startsWith(\"Unsupported feature\")) {\n        // surface supported feature list to the user\n    }\n}","preventionTips":["When adding a Feature enum constant, update the factory switch in the same change.","Expose the supported feature set to the UI so users cannot select unmapped values.","Validate feature against the supported set before calling the factory."],"tags":["appsmith-ai","appsmith","feature-routing","switch","enum"],"backgroundTag":null,"analyzedSha":"8cd9021c24cdbea1c3c12c966073708e83db60c2","analyzedAt":"2026-08-12T22:14:19.293Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}