Browse Source

fix(smartfetch): surface actual API error in session.create failure message

Michael Henke 3 weeks ago
parent
commit
bf3fa5e32e
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/tools/smartfetch/secondary-model.ts

+ 7 - 1
src/tools/smartfetch/secondary-model.ts

@@ -221,7 +221,13 @@ async function runSecondaryModel(
   const session = sessionResponse.data;
   const sessionId = session?.id;
   if (!sessionId) {
-    throw new Error('Secondary model session did not return an id');
+    const errorDetail =
+      sessionResponse && 'error' in sessionResponse
+        ? `: ${JSON.stringify(sessionResponse.error)}`
+        : '';
+    throw new Error(
+      `Secondary model session did not return an id${errorDetail}`,
+    );
   }
 
   const sourceChars = content.length;