{"record":{"id":"d95de55f0ef1b2f5","repo":"apache/pulsar","slug":"e-getmessage-d95de5","errorCode":null,"errorMessage":"e.getMessage()","messagePattern":"e\\.getMessage\\(\\)","errorType":"exception","errorClass":"TypeConversionException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/localrun/src/main/java/org/apache/pulsar/functions/LocalRunner.java","lineNumber":124,"sourceCode":"\n    public enum RuntimeEnv {\n        THREAD,\n        PROCESS\n    }\n\n    @Value\n    private static class UserCodeClassLoader {\n        ClassLoader classLoader;\n        boolean classLoaderCreated;\n    }\n\n    public static class FunctionConfigConverter implements ITypeConverter<FunctionConfig> {\n        @Override\n        public FunctionConfig convert(String value) {\n            try {\n                return ObjectMapperFactory.getMapper().reader().readValue(value, FunctionConfig.class);\n            } catch (IOException e) {\n                throw new TypeConversionException(e.getMessage());\n            }\n        }\n    }\n\n    public static class SourceConfigConverter implements ITypeConverter<SourceConfig> {\n        @Override\n        public SourceConfig convert(String value) {\n            try {\n                return ObjectMapperFactory.getMapper().reader().readValue(value, SourceConfig.class);\n            } catch (IOException e) {\n                throw new TypeConversionException(e.getMessage());\n            }\n        }\n    }\n\n    public static class SinkConfigConverter implements ITypeConverter<SinkConfig> {\n        @Override\n        public SinkConfig convert(String value) {","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/localrun/src/main/java/org/apache/pulsar/functions/LocalRunner.java#L106-L142","documentation":"LocalRunner's FunctionConfigConverter converts a JSON command-line argument into a FunctionConfig via Jackson. If the JSON cannot be parsed or doesn't match FunctionConfig (IOException), it wraps e.getMessage() in jcommander's TypeConversionException, so localrun aborts with the raw Jackson message.","triggerScenarios":"Passing malformed JSON to --functionConfig on the pulsar-functions localrun command line (trailing commas, single quotes, non-JSON text, wrong field names/types).","commonSituations":"Shell quoting mangling the JSON (spaces/newlines); copy-pasted YAML instead of JSON; passing a file path instead of JSON content; mismatched field types like resources as strings.","solutions":["Validate the JSON string (e.g. python3 -m json.tool) and fix syntax before running localrun.","Quote the whole --functionConfig argument properly for your shell; read JSON from a file with $(cat config.json) if needed.","Ensure field names and types match FunctionConfig (e.g. className, inputs, output).","Read the TypeConversionException message — it is the raw Jackson parse error indicating the exact problem."],"exampleFix":"# before\n--functionConfig '{\"className\": myFunction}'   # invalid JSON\n# after\n--functionConfig '{\"className\":\"com.example.MyFunction\",\"inputs\":[\"input-topic\"],\"output\":\"out-topic\"}'","handlingStrategy":"try-catch","validationCode":"python3 -c 'import json,sys; json.load(open(sys.argv[1]))' function-config.json  # validate before passing","typeGuard":null,"tryCatchPattern":"try { ... } catch (ParameterException e) {\n    if (e.getCause() instanceof TypeConversionException) {\n        // fix the --functionConfig JSON; message is the Jackson parse error\n    }\n}","preventionTips":["Keep function configs as JSON files and validate with a linter.","Use single-quoted shell strings or $(cat file.json).","Verify field names/types against FunctionConfig schema.","Test localrun invocation in CI."],"tags":["java","cli","json","pulsar-functions","localrun"],"backgroundTag":"json-parse-error","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}