{"record":{"id":"10c377a28334c61b","repo":"hasura/graphql-engine","slug":"unknown-escape-sequence-in-string-0","errorCode":null,"errorMessage":"unknown escape sequence in string: {0:?}","messagePattern":"unknown escape sequence in string: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/lang-graphql/src/lexer/string.rs","lineNumber":29,"sourceCode":"    ///\n    /// Apart from forgetting the ending `\"`, terminating a string within a\n    /// Unicode escape sequence or having a line break in the string also\n    /// causes this error.\n    #[error(\"string is unterminated\")]\n    Unterminated,\n\n    /// An unknown character in a string literal was found\n    ///\n    /// This occurs when an invalid source character is found in a string\n    /// literal, such as ASCII control characters.\n    #[error(\"unexpected character in string: {0:?}\")]\n    UnknownCharacterInString(char),\n\n    /// An unknown escape sequence in a string literal was found\n    ///\n    /// Only a limited set of escape sequences are supported, this is emitted\n    /// when e.g. `\"\\l\"` is parsed.\n    #[error(\"unknown escape sequence in string: {0:?}\")]\n    UnknownEscapeSequence(String),\n\n    /// An invalid unicode escape sequence in a string literal was found, and\n    /// an error message is provided.\n    ///\n    /// This began with `\"\\u\"` being parsed and then something going wrong.\n    #[error(\"invalid unicode escape sequence in string. {0:?}\")]\n    InvalidUnicodeEscapeSequence(String),\n}\n\npub struct Consumed {\n    /// Number of line breaks consumed.\n    pub line_breaks: usize,\n    /// Number of characters consumed without hitting a further line break.\n    pub chars_without_further_line_break: usize,\n}\n\nimpl Consumed {","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/lang-graphql/src/lexer/string.rs#L11-L47","documentation":"Thrown when a backslash escape inside a GraphQL string literal is not one of the recognized escape sequences (\\\" \\\\ \\/ \\b \\f \\n \\r \\t \\uXXXX). The invalid sequence text is included in the message.","triggerScenarios":"Parsing a document with an escape like \"\\\\l\", \"\\\\x41\", or a shell/regex-style escape such as \"\\\\d+\" inside a GraphQL string.","commonSituations":"Embedding regular expressions, Windows paths, or LaTeX-like text in GraphQL string arguments without doubling the backslashes; translating queries from another language that supports more escapes.","solutions":["Double the backslash for a literal backslash: \"\\\\\\\\\"","Use the supported escape (e.g. \\u006c instead of \\l)","Move regex/paths out of the query or encode them differently"],"exampleFix":"# before\n{ match(pattern: \"\\\\d+\") }   # \\d is not a GraphQL escape\n# after\n{ match(pattern: \"\\\\\\\\d+\") }  # escaped backslash + d","handlingStrategy":"validation","validationCode":"const VALID: [&str; 8] = [\"\\\\\\\"\",\"\\\\\\\\\",\"\\\\/\",\"\\\\b\",\"\\\\f\",\"\\\\n\",\"\\\\r\",\"\\\\t\"];\n// verify every escape in the string is in VALID or starts with \\\\u","typeGuard":null,"tryCatchPattern":"Catch the lexer Error and inspect the InvalidString(string::Error::UnknownEscapeSequence(..)) variant to surface which escape failed.","preventionTips":["Escape literal backslashes before interpolating into GraphQL strings","Use GraphQL variables for user-supplied text"],"tags":["graphql","lexer","escape-sequence","string-literal"],"backgroundTag":"graphql-syntax-error","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}