From 315b06cbf9c4e23c8cb7a17df685d21f97ef0ce1 Mon Sep 17 00:00:00 2001 From: Gohlub <62673775+Gohlub@users.noreply.github.com> Date: Tue, 23 Sep 2025 10:40:28 -0400 Subject: [PATCH] better error logging --- provider/provider/src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/provider/provider/src/lib.rs b/provider/provider/src/lib.rs index a039043..f603055 100644 --- a/provider/provider/src/lib.rs +++ b/provider/provider/src/lib.rs @@ -790,7 +790,15 @@ impl HypergridProviderState { return Ok(response); }, Err(e) => { - last_error = e.clone(); + // Enhanced error handling with specific guidance for LLMs + last_error = if e.contains("404") || e.contains("Not Found") { + format!("{}\n\nNOTE: This is a 404 error. Since payments are made optimistically (ahead of time), please double-check that you are providing the correct arguments for this provider. Verify the argument names, values, and format according to the provider's documentation. Each time you call a provider, you will be charged the price of the provider.", e) + } else if e.contains("401") || e.contains("403") || e.contains("Unauthorized") || e.contains("Forbidden") { + format!("{}\n\nNOTE: This is an authorization error. The provider may no longer be valid or properly configured. The provider's API keys, permissions, or configuration may have changed.", e) + } else { + e + }; + error!( "provider_call_attempt_failed: provider={}, source_node={}, attempt={}, error_type=api_call_failed", registered_provider.provider_name,