langflow icon indicating copy to clipboard operation
langflow copied to clipboard

fix: prevent UI from getting stuck when switching to cURL mode after parse errors

Open andifilhohub opened this issue 1 month ago • 1 comments

Previously, when switching to cURL mode, a failure during parse_curl would break the internal build_config update, leaving the interface visually stuck in URL mode. This patch ensures curl_input is always displayed when mode="cURL" and cURL parsing errors are safely logged without interrupting the UI state update.

reported here: https://github.com/langflow-ai/langflow/issues/10501

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling for cURL input parsing to prevent application crashes when invalid input is encountered, while preserving existing configuration settings.

andifilhohub avatar Nov 05 '25 17:11 andifilhohub

[!IMPORTANT]

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The change adds error handling to the update_build_config function in api_request.py. When in cURL mode with curl_input present, parsing is now wrapped in a try/except block that catches ValueError exceptions, logs a failure message, and continues without raising the error, preserving the existing build_config state.

Changes

Cohort / File(s) Summary
Error handling for cURL parsing
src/lfx/src/lfx/components/data/api_request.py
Added try/except block around parse_curl call in update_build_config to catch ValueError, log failure, and continue without re-raising

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Focused change in a single function with straightforward error handling logic
  • Verify that swallowing ValueError is the correct behavior and doesn't mask legitimate parsing issues
  • Confirm the logged failure message provides sufficient debugging information
  • Check that preserving the previous build_config state is the intended behavior when parsing fails

Possibly related PRs

  • #8353: Also modifies update_build_config in api_request.py to change cURL input parsing behavior—adds parse_curl invocation and conditional parsing logic when curl_input changes, whereas this PR wraps existing parse_curl in error handling.

Suggested labels

bug, size:XS, lgtm

Suggested reviewers

  • Cristhianzl
  • Yukiyukiyeah

Pre-merge checks and finishing touches

❌ Failed checks (1 error, 1 warning, 2 inconclusive)
Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error PR implements bug fix for parse_curl error handling but lacks corresponding test coverage. Add unit tests verifying update_build_config handles ValueError exceptions gracefully and preserves build_config state when parsing fails.
Test File Naming And Structure ⚠️ Warning The PR modifies error handling in api_request.py with a try/except block but includes no test files to verify the new error handling behavior, logging, or build_config state preservation. Add test_api_request.py following pytest patterns with tests for: successful curl parsing, ValueError exception handling, build_config state preservation on errors, and curl_input display after parse failures.
Test Quality And Coverage ❓ Inconclusive Repository not accessible in sandbox environment preventing evaluation of test coverage for bug fix implementation. Provide access to modified api_request.py file, test files for api_request module, and confirmation of test coverage for valid and invalid cURL input scenarios.
Excessive Mock Usage Warning ❓ Inconclusive Cannot assess excessive mock usage without access to test files covering the modified api_request.py module. Provide test files for api_request.py to analyze mock usage patterns and verify if mocks are used appropriately for external dependencies only.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: preventing UI freezing when switching to cURL mode after parse errors, which matches the changeset's core objective.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Nov 05 '25 17:11 coderabbitai[bot]