Skip to content

Comments

fix(proxy): prevent panic when upstream client builder rejects headers#2005

Merged
lbjlaq merged 5 commits intolbjlaq:mainfrom
OmerFarukOruc:fix/upstream-client-invalid-header-panic
Feb 17, 2026
Merged

fix(proxy): prevent panic when upstream client builder rejects headers#2005
lbjlaq merged 5 commits intolbjlaq:mainfrom
OmerFarukOruc:fix/upstream-client-invalid-header-panic

Conversation

@OmerFarukOruc
Copy link
Contributor

Summary

  • remove panic path in UpstreamClient::new when default client creation fails
  • retry client construction without upstream proxy on builder failure
  • add final fallback to Client::new() so proxy service can continue instead of crashing
  • validate default User-Agent header value before applying it to client builders, and fallback to a safe UA when invalid

Why

Issue #2004 reports runtime panic:

  • thread 'tokio-runtime-worker' ... Failed to create default HTTP client: rquest::Error { kind: Builder, source: http::Error(InvalidHeaderValue) }

This change hardens startup to avoid panicking on InvalidHeaderValue and keeps proxy service alive with safe fallbacks.

Verification

  • cargo test --manifest-path src-tauri/Cargo.toml test_build_url -- --nocapture
  • result: build currently fails in this environment before reaching tests due boring-sys2 bindgen toolchain issue (fatal error: 'stddef.h' file not found), unrelated to this patch
  • manually verified logic path: panic-causing expect(...) removed and replaced with non-panicking fallback handling

Closes #2004

@lbjlaq lbjlaq merged commit 6e3f19e into lbjlaq:main Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v4.1.20 regression: proxy panics at client.rs:72 with InvalidHeaderValue on Linux — service cannot start

2 participants