{"record":{"id":"4dc2c2b68454fe0c","repo":"gchq/CyberChef","slug":"unable-to-detect-the-input-delimiter-automatically","errorCode":null,"errorMessage":"Unable to detect the input delimiter automatically.","messagePattern":"Unable to detect the input delimiter automatically\\.","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/lib/ConvertCoordinates.mjs","lineNumber":86,"sourceCode":"        hash,\n        utm,\n        mgrs,\n        osng,\n        splitLat,\n        splitLong,\n        lat,\n        lon;\n\n    // Can't have a precision less than 0!\n    if (precision < 0) {\n        precision = 0;\n    }\n\n    if (inDelim === \"Auto\") {\n        // Try to detect a delimiter in the input.\n        inDelim = findDelim(input);\n        if (inDelim === null) {\n            throw new OperationError(\"Unable to detect the input delimiter automatically.\");\n        }\n    } else if (!inDelim.includes(\"Direction\")) {\n        // Convert the delimiter argument value to the actual character\n        inDelim = realDelim(inDelim);\n    }\n\n    if (inFormat === \"Auto\") {\n        // Try to detect the format of the input data\n        inFormat = findFormat(input, inDelim);\n        if (inFormat === null) {\n            throw new OperationError(\"Unable to detect the input format automatically.\");\n        }\n    }\n\n    // Convert the output delimiter argument to the real character\n    outDelim = realDelim(outDelim);\n\n    if (!NO_CHANGE.includes(inFormat)) {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/lib/ConvertCoordinates.mjs#L68-L104","documentation":"Thrown by convertCoordinates when inDelim is 'Auto' and findDelim cannot recognise a delimiter. findDelim only recognises compass-direction splits (N/E/S/W producing 1-3 segments) or one of the literal characters comma, semicolon, colon. If the input uses spaces, tabs, newlines, pipes, or has more than three segments, auto-detection returns null and the error fires.","triggerScenarios":"convertCoordinates called with inDelim='Auto' on input delimited by whitespace, a pipe '|', an en-dash, or any character outside {',', ';', ':'} that also contains no compass letters. Also fires when the input has more than 3 segments after splitting on a found delimiter.","commonSituations":"Pasting coordinates copied from a source that uses spaces or tabs between lat and lon; data exported as TSV; mixing multiple delimiters; input already pre-split into more than two values.","solutions":["Pass an explicit inDelim value (e.g. 'Space', 'Comma') instead of 'Auto'.","Reformat the input to use a recognised delimiter (comma, semicolon, or colon).","Pre-trim and normalise whitespace, or convert delimiters before calling convertCoordinates."],"exampleFix":"// before\nconvertCoordinates(\"51.5074 -0.1278\", \"Auto\", ...); // space not auto-detected\n\n// after\nconvertCoordinates(\"51.5074 -0.1278\", \"Space\", ...);","handlingStrategy":"validation","validationCode":"import { findDelim } from \".../ConvertCoordinates.mjs\";\nif (inDelim === \"Auto\" && findDelim(input) === null) {\n  throw new Error(\"No delimiter detected; pass an explicit inDelim (e.g. 'Comma', 'Space').\");\n}\nconvertCoordinates(input, inFormat, inDelim, outFormat, outDelim, includeDir, precision);","typeGuard":null,"tryCatchPattern":"try {\n  convertCoordinates(input, inFormat, \"Auto\", outFormat, outDelim, includeDir, precision);\n} catch (e) {\n  if (/delimiter/i.test(e.message)) {\n    // retry with an explicit delimiter based on known data shape\n    convertCoordinates(input, inFormat, guessDelim(input), outFormat, outDelim, includeDir, precision);\n  } else throw e;\n}","preventionTips":["Avoid 'Auto' for delimiter when you know the data format.","Pre-trim input and collapse runs of whitespace.","For tab/space-separated data pass inDelim='Space'."],"tags":["coordinates","geo","input-validation","delimiter-detection"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}