{"record":{"id":"063717ea12e80152","repo":"pinpoint-apm/pinpoint","slug":"unexpected-samplertype-samplertype","errorCode":null,"errorMessage":"Unexpected samplerType: ${samplerType}","messagePattern":"Unexpected samplerType: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/sampler/SamplerProvider.java","lineNumber":67,"sourceCode":"        if (!config.isSamplingEnable()) {\n            return FalseSampler.INSTANCE;\n        }\n\n        SamplerType samplerType = config.getSamplerType();\n        SamplerFactory samplerFactory = newSamplerFactory(samplerType, profilerConfig);\n\n        return samplerFactory.createSampler();\n    }\n\n    private SamplerFactory newSamplerFactory(SamplerType samplerType, ProfilerConfig profilerConfig) {\n        switch (samplerType) {\n            case COUNTING:\n                return newCountingSamplerFactory(profilerConfig);\n            case PERCENT:\n                return newPercentSamplerFactory(profilerConfig);\n            default:\n                // parse fail\n                throw new IllegalStateException(\"Unexpected samplerType: \" + samplerType);\n        }\n    }\n\n    private SamplerFactory newCountingSamplerFactory(ProfilerConfig profilerConfig) {\n\n        CountingSamplerFactory.Config config = CountingSamplerFactory.config(profilerConfig);\n        logger.info(\"CountingSamplerFactory.Config:{}\", config);\n\n        return new CountingSamplerFactory(config);\n    }\n\n    private SamplerFactory newPercentSamplerFactory(ProfilerConfig profilerConfig) {\n\n        PercentSamplerFactory.Config config = PercentSamplerFactory.config(profilerConfig);\n        logger.info(\"PercentSamplerFactory.Config:{}\", config);\n\n        return new PercentSamplerFactory(config);\n    }","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/sampler/SamplerProvider.java#L49-L85","documentation":"SamplerProvider.newSamplerFactory throws IllegalStateException('Unexpected samplerType') when the parsed TraceSamplerType does not match any supported switch case (e.g. COUNTING or PERCENT). The default branch marks a parse failure of the configured sampler type string. It prevents the profiler from running with an unknown sampling strategy.","triggerScenarios":"The profiler.sampling.type... configuration value fails to map to a known TraceSamplerType during parsing, so samplerFactory -> newSamplerFactory ends in the switch default branch.","commonSituations":"Typos in the sampling type property (e.g. 'percet' instead of 'percent'), an unsupported sampler type name copied from an example config, or a config file from a different Pinpoint version with a removed sampler type.","solutions":["Set profiler.sampling.type... to a supported value: PERCENT or COUNTING","Fix typos in the sampling configuration property value","Check the Pinpoint version's documentation for valid sampler type names and remove unsupported values","Validate the whole profiler configuration file after an upgrade"],"exampleFix":"// before\nprofiler.sampling.type.sampling=new\nprofiler.sampling.new.sampler.type=percet\n// after\nprofiler.sampling.type.sampling=new\nprofiler.sampling.new.sampler.type=percent","handlingStrategy":"validation","validationCode":"String samplerType = config.readString(\"profiler.sampling.new.sampler.type\");\nif (!\"PERCENT\".equalsIgnoreCase(samplerType) && !\"COUNTING\".equalsIgnoreCase(samplerType)) {\n    throw new IllegalArgumentException(\"Invalid sampler type: \" + samplerType);\n}","typeGuard":"boolean isValidSamplerType(String s) {\n    return \"PERCENT\".equalsIgnoreCase(s) || \"COUNTING\".equalsIgnoreCase(s);\n}","tryCatchPattern":"try {\n    Sampler sampler = samplerProvider.get();\n} catch (IllegalStateException e) {\n    logger.error(\"Sampler configuration invalid: {}\", e.getMessage());\n    throw e;\n}","preventionTips":["Validate profiler.sampling.* values against the documented enum after every config edit","Copy sampling config only from the same Pinpoint version's example files","Lint the profiler configuration at startup before sampling is needed"],"tags":["config","pinpoint-profiler","sampling"],"backgroundTag":"invalid-config-value","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}