{"record":{"id":"8ff3ee9db184ab35","repo":"quarkusio/quarkus","slug":"unexpected-character-at-linenumber-pos-curren","errorCode":null,"errorMessage":"Unexpected character at <lineNumber>:<pos>, current state is <state.name()>","messagePattern":"Unexpected character at <lineNumber>:<pos>, current state is <state\\.name\\(\\)>","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/client/RedisDataLoader.java","lineNumber":111,"sourceCode":"                    request.arg(getAndClear(current));\n                    state = State.ARGUMENTS;\n                }\n            } else if (state == State.PARAM_IN_QUOTES) {\n                if (c != '\\'') {\n                    current.append(c);\n                } else {\n                    request.arg(getAndClear(current));\n                    state = State.ARGUMENTS;\n                }\n            } else if (state == State.PARAM_IN_DOUBLE_QUOTES) {\n                if (c != '\"') {\n                    current.append(c);\n                } else {\n                    request.arg(getAndClear(current));\n                    state = State.ARGUMENTS;\n                }\n            } else {\n                throw new IllegalStateException(\"Unexpected character at \" + lineNumber + \":\" + pos\n                        + \", current state is \" + state.name());\n            }\n        }\n\n        if (current.length() > 0) {\n            if (state == State.COMMAND) {\n                request = Request.cmd(Command.create(getAndClear(current)));\n            } else if (state == State.PARAM) {\n                request.arg(getAndClear(current));\n            } else {\n                throw new IllegalStateException(\"End of line unexpected at \" + lineNumber + \":\" + pos);\n            }\n        }\n\n        return request;\n\n    }\n","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/client/RedisDataLoader.java#L93-L129","documentation":"RedisDataLoader parses a RESP-like text script where each line is a command followed by whitespace-separated arguments. The parser encountered a character it cannot process in the current state and throws IllegalStateException with line, column and state to pinpoint the malformed token.","triggerScenarios":"A line in the import file contains an invalid character such as a stray quote, comma, or comment marker in the wrong position; arguments containing unquoted spaces or special characters the simple tokenizer cannot handle; edited/corrupted export file.","commonSituations":"Hand-editing import scripts and introducing syntax errors; pasting RESP output with binary prefixes (*) into the text loader; shell escaping issues leaving quotes in the file; comments (# or //) placed mid-line where they are not supported.","solutions":["Open the file at the reported line:column and fix or remove the offending character","Keep each command on a single line: command name followed by space-separated arguments, no inline comments or stray quotes","Escape or remove special characters (quotes, commas, brackets) from argument values","Regenerate the import file from a known-good export or official seed script"],"exampleFix":"// before (import.redis)\nSET mykey \"hello world\" // inline comment breaks parser\n// after\nSET mykey hello-world // one command per line, plain args\n# comments only on their own line if supported by your file format","handlingStrategy":"validation","validationCode":"List<String> lines = java.nio.file.Files.readAllLines(java.nio.file.Path.of(path));\nfor (int i = 0; i < lines.size(); i++) {\n    String line = lines.get(i).trim();\n    if (!line.isEmpty() && !line.matches(\"[A-Za-z]+(\\s+[^\\s\\\"',]+)*\")) {\n        throw new IllegalStateException(\"Suspicious syntax at line \" + (i + 1) + \": \" + line);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    RedisDataLoader.load(vertx, redis, path);\n} catch (IllegalStateException e) {\n    log.error(\"Malformed import script: \" + e.getMessage());\n}","preventionTips":["One command per line, plain space-separated arguments, no inline comments","Avoid quotes and special characters unless you know the loader accepts them","Validate the script by running it against a scratch Redis before production import"],"tags":["redis","parsing","data-import","syntax"],"backgroundTag":"malformed-import-script","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}