langflow-ai/langflow · error · Error

Error in parser ${parser}

Error message

Error in parser ${parser}

What it means

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.

Source

Thrown at src/frontend/src/utils/stringManipulation.ts:183

          break;
        case "no_blank":
          result = noBlank(result);
          break;
        case "space_case":
          result = toSpaceCase(result);
          break;
        case "valid_csv":
          result = validCsv(result);
          break;
        case "commands":
          result = validCommands(result);
          break;
        case "sanitize_mcp_name":
          result = sanitizeMcpName(result);
          break;
      }
    } catch (_error) {
      throw new Error(`Error in parser ${parser}`);
    }
  }

  return result;
}

export const getStatusColor = (status: string): string => {
  const amberStatuses = [
    "initializing",
    "pending",
    "hibernating",
    "hiberated",
    "maintenance",
    "parked",
  ];

  if (amberStatuses.includes(status?.toLowerCase())) {
    return "text-accent-amber-foreground";

View on GitHub (pinned to 976ec789d2)

Solutions

  1. 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
  2. Pre-validate input type (string, non-empty) before running the cascade
  3. Fix the underlying parser to handle the edge case instead of relying on the catch
  4. If you must keep the cascade, log _error alongside rethrowing so the root cause is not lost

Example fix

// before
} catch (_error) {
  throw new Error(`Error in parser ${parser}`);
}

// after — preserve root cause for debugging
} catch (_error) {
  throw new Error(`Error in parser ${parser}: ${String(_error)}`);
}
Defensive patterns

Strategy: try-catch

Validate before calling

const PARSERS = new Set(["valid_json", "valid_csv", "commands", "sanitize_mcp_name"]);
if (!PARSERS.has(parser)) skip();
if (typeof input !== "string" || input.length === 0) skip();

Type guard

const isKnownParser = (p: string): boolean =>
  ["valid_json", "valid_csv", "commands", "sanitize_mcp_name"].includes(p);

Try / catch

try {
  result = applyParsers(input, parsers);
} catch (e) {
  if (e instanceof Error && e.message.startsWith("Error in parser")) {
    const failed = e.message.replace("Error in parser ", "");
    log.warn({ failed, input }); // capture the swallowed root cause's context
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/20e6d3fbbf3860e0. Report an issue: GitHub.