{"record":{"id":"20e6d3fbbf3860e0","repo":"langflow-ai/langflow","slug":"error-in-parser-parser","errorCode":null,"errorMessage":"Error in parser ${parser}","messagePattern":"Error in parser (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/frontend/src/utils/stringManipulation.ts","lineNumber":183,"sourceCode":"          break;\n        case \"no_blank\":\n          result = noBlank(result);\n          break;\n        case \"space_case\":\n          result = toSpaceCase(result);\n          break;\n        case \"valid_csv\":\n          result = validCsv(result);\n          break;\n        case \"commands\":\n          result = validCommands(result);\n          break;\n        case \"sanitize_mcp_name\":\n          result = sanitizeMcpName(result);\n          break;\n      }\n    } catch (_error) {\n      throw new Error(`Error in parser ${parser}`);\n    }\n  }\n\n  return result;\n}\n\nexport const getStatusColor = (status: string): string => {\n  const amberStatuses = [\n    \"initializing\",\n    \"pending\",\n    \"hibernating\",\n    \"hiberated\",\n    \"maintenance\",\n    \"parked\",\n  ];\n\n  if (amberStatuses.includes(status?.toLowerCase())) {\n    return \"text-accent-amber-foreground\";","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/frontend/src/utils/stringManipulation.ts#L165-L201","documentation":"Catch-all thrown by the parser cascade in stringManipulation.ts: the input is run through a chain of named parsers (valid_csv, commands, sanitize_mcp_name, etc.) inside a switch, and one of them threw. The original exception is swallowed; only the failing parser's name is embedded in the message.","triggerScenarios":"Calling the cascade (used by input parsing / MCP name handling) with input that crashes a specific parser — e.g. validCsv on malformed CSV rows, validCommands on a non-string, or sanitizeMcpName on an unexpected type slipped through untyped callers.","commonSituations":"Hand-crafted parser lists passed with data of the wrong type; edge-case inputs (empty string, unicode, very long strings) hitting an unguarded regex/operation inside a parser.","solutions":["Reproduce with the same input and drop into the named parser function to find the real line — the thrown error's `parser` value tells you which file/function to open","Pre-validate input type (string, non-empty) before running the cascade","Fix the underlying parser to handle the edge case instead of relying on the catch","If you must keep the cascade, log _error alongside rethrowing so the root cause is not lost"],"exampleFix":"// before\n} catch (_error) {\n  throw new Error(`Error in parser ${parser}`);\n}\n\n// after — preserve root cause for debugging\n} catch (_error) {\n  throw new Error(`Error in parser ${parser}: ${String(_error)}`);\n}","handlingStrategy":"try-catch","validationCode":"const PARSERS = new Set([\"valid_json\", \"valid_csv\", \"commands\", \"sanitize_mcp_name\"]);\nif (!PARSERS.has(parser)) skip();\nif (typeof input !== \"string\" || input.length === 0) skip();","typeGuard":"const isKnownParser = (p: string): boolean =>\n  [\"valid_json\", \"valid_csv\", \"commands\", \"sanitize_mcp_name\"].includes(p);","tryCatchPattern":"try {\n  result = applyParsers(input, parsers);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith(\"Error in parser\")) {\n    const failed = e.message.replace(\"Error in parser \", \"\");\n    log.warn({ failed, input }); // capture the swallowed root cause's context\n  } else throw e;\n}","preventionTips":["Pre-check input type/shape per parser before running the cascade","Patch the catch to chain the original error (see exampleFix) so future hits are diagnosable","Keep parser lists static and reviewed — dynamic parser names typos become runtime errors here"],"tags":["frontend","parsing","error-masking","utilities"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}