{"record":{"id":"9cc423867443b202","repo":"hasura/graphql-engine","slug":"expected-a-but-found-0","errorCode":null,"errorMessage":"expected a \\\" but found: {0:?}","messagePattern":"expected a \\\\\" but found: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/lang-graphql/src/lexer/string.rs","lineNumber":7,"sourceCode":"use std::cmp::min;\nuse std::str::from_utf8_unchecked;\nuse thiserror::Error;\n\n#[derive(Error, Debug, PartialEq, Eq, Clone)]\npub enum Error {\n    #[error(\"expected a \\\" but found: {0:?}\")]\n    StartingSequenceNotFound(Option<u8>),\n\n    /// An unterminated string literal was found\n    ///\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","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/lang-graphql/src/lexer/string.rs#L1-L25","documentation":"String lexer error: expected an opening double-quote to start a string literal but found a different byte (or None at end of input). Raised by the string scanner when a string start sequence is required but absent.","triggerScenarios":"Query text where a string is expected but the quote is missing, e.g. argument value typed as a bare word where a string was required; truncated input ending right before a string.","commonSituations":"Hand-written queries with missing quotes; templating bugs stripping quotes; truncated request bodies.","solutions":["Quote the string literal in the query","Use GraphQL variables for string values","Check for truncation of the request body (Content-Length issues, proxy cut-offs)"],"exampleFix":"# before\nquery { songs(where: {title: {_eq: hey}}) }\n# after\nquery { songs(where: {title: {_eq: \"hey\"}}) }","handlingStrategy":"validation","validationCode":"// Ensure every inline string argument starts with a quote\n// e.g. lint: /:\\s*[^\\s\"\\[\\{\\$]/ after an argument colon","typeGuard":null,"tryCatchPattern":"// Catch the lexer error, reprint the query region around the offset, and quote the literal","preventionTips":["Use variables for string values","Run client-side parse (graphql-js parse) before sending"],"tags":["graphql","lexer","string","parse-error"],"backgroundTag":"graphql-string-lex-error","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}