{"record":{"id":"f19bcd8d9c2d1044","repo":"apache/skywalking","slug":"failed-to-load-genai-configuration-file","errorCode":null,"errorMessage":"Failed to load GenAI configuration file.","messagePattern":"Failed to load GenAI configuration file\\.","errorType":"exception","errorClass":"ModuleStartException","httpStatus":null,"severity":"error","filePath":"oap-server/analyzer/gen-ai-analyzer/src/main/java/org/apache/skywalking/oap/analyzer/genai/config/GenAIConfigLoader.java","lineNumber":44,"sourceCode":"\n/**\n * Loads {@link GenAIConfig} by delegating to {@link GenAIPricingConfigLoader}\n * and converting to the module-specific config (adds baseUrl support).\n */\npublic class GenAIConfigLoader {\n\n    private final GenAIConfig config;\n\n    public GenAIConfigLoader(GenAIConfig config) {\n        this.config = config;\n    }\n\n    public GenAIConfig loadConfig() throws ModuleStartException {\n        GenAIPricingConfig pricingConfig;\n        try {\n            pricingConfig = GenAIPricingConfigLoader.load();\n        } catch (IOException e) {\n            throw new ModuleStartException(\n                \"Failed to load GenAI configuration file.\", e);\n        } catch (IllegalArgumentException e) {\n            throw new ModuleStartException(e.getMessage(), e);\n        }\n\n        for (GenAIPricingConfig.Provider pp : pricingConfig.getProviders()) {\n            GenAIConfig.Provider provider = new GenAIConfig.Provider();\n            provider.setProvider(pp.getProvider());\n            provider.setPrefixMatch(pp.getPrefixMatch());\n\n            for (GenAIPricingConfig.Model pm : pp.getModels()) {\n                GenAIConfig.Model model = new GenAIConfig.Model();\n                model.setName(pm.getName());\n                model.setAliases(pm.getAliases());\n                model.setInputEstimatedCostPerM(pm.getInputEstimatedCostPerM());\n                model.setOutputEstimatedCostPerM(pm.getOutputEstimatedCostPerM());\n                provider.getModels().add(model);\n            }","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/analyzer/gen-ai-analyzer/src/main/java/org/apache/skywalking/oap/analyzer/genai/config/GenAIConfigLoader.java#L26-L62","documentation":"Thrown by Layer.registerDynamic when the layer name is null or does not match the pattern [A-Z][A-Z0-9_]* (one uppercase letter followed by uppercase letters, digits, or underscores). Layer names double as enum-style constants (the class used to be an enum), so lowercase, digits first, spaces, hyphens, and empty strings are rejected.","triggerScenarios":"Calling Layer.registerDynamic(name, value, isNormal) with a name like 'my-layer', 'MyLayer', '2FA', 'LOG ANALYSIS', or null — typically from a runtime MAL/LAL layerDefinitions entry whose name field was written in prose or camelCase.","commonSituations":"Authoring a layerDefinitions block for the first time; pasting display names (e.g. 'Log Analysis') instead of constant-style names; feeding a YAML null/empty value into the name field.","solutions":["Rename the layer to uppercase constant style, e.g. MY_LAYER, LOG_ANALYSIS, K8S_NODE","Ensure the name starts with a letter (not a digit) and contains only A-Z, 0-9, underscore","Check the YAML for a missing or mistyped name key that yields null"],"exampleFix":"# before\nlayerDefinitions:\n  - name: log-analysis\n    ordinal: 100000\n# after\nlayerDefinitions:\n  - name: LOG_ANALYSIS\n    ordinal: 100000","handlingStrategy":"validation","validationCode":"private static final java.util.regex.Pattern P = java.util.regex.Pattern.compile(\"[A-Z][A-Z0-9_]*\");\nboolean valid = name != null && P.matcher(name).matches();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write layer names as SCREAMING_SNAKE_CASE constants","Validate YAML inputs in rule-file linters before hot-reload"],"tags":["skywalking","oap","layer","validation","configuration"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}