apache/skywalking · error · ModuleStartException

Failed to load GenAI configuration file.

Error message

Failed to load GenAI configuration file.

What it means

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.

Source

Thrown at oap-server/analyzer/gen-ai-analyzer/src/main/java/org/apache/skywalking/oap/analyzer/genai/config/GenAIConfigLoader.java:44

/**
 * Loads {@link GenAIConfig} by delegating to {@link GenAIPricingConfigLoader}
 * and converting to the module-specific config (adds baseUrl support).
 */
public class GenAIConfigLoader {

    private final GenAIConfig config;

    public GenAIConfigLoader(GenAIConfig config) {
        this.config = config;
    }

    public GenAIConfig loadConfig() throws ModuleStartException {
        GenAIPricingConfig pricingConfig;
        try {
            pricingConfig = GenAIPricingConfigLoader.load();
        } catch (IOException e) {
            throw new ModuleStartException(
                "Failed to load GenAI configuration file.", e);
        } catch (IllegalArgumentException e) {
            throw new ModuleStartException(e.getMessage(), e);
        }

        for (GenAIPricingConfig.Provider pp : pricingConfig.getProviders()) {
            GenAIConfig.Provider provider = new GenAIConfig.Provider();
            provider.setProvider(pp.getProvider());
            provider.setPrefixMatch(pp.getPrefixMatch());

            for (GenAIPricingConfig.Model pm : pp.getModels()) {
                GenAIConfig.Model model = new GenAIConfig.Model();
                model.setName(pm.getName());
                model.setAliases(pm.getAliases());
                model.setInputEstimatedCostPerM(pm.getInputEstimatedCostPerM());
                model.setOutputEstimatedCostPerM(pm.getOutputEstimatedCostPerM());
                provider.getModels().add(model);
            }

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Rename the layer to uppercase constant style, e.g. MY_LAYER, LOG_ANALYSIS, K8S_NODE
  2. Ensure the name starts with a letter (not a digit) and contains only A-Z, 0-9, underscore
  3. Check the YAML for a missing or mistyped name key that yields null

Example fix

# before
layerDefinitions:
  - name: log-analysis
    ordinal: 100000
# after
layerDefinitions:
  - name: LOG_ANALYSIS
    ordinal: 100000
Defensive patterns

Strategy: validation

Validate before calling

private static final java.util.regex.Pattern P = java.util.regex.Pattern.compile("[A-Z][A-Z0-9_]*");
boolean valid = name != null && P.matcher(name).matches();

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14). Data as JSON: /api/errors/f19bcd8d9c2d1044. Report an issue: GitHub.