Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"APICallError [AI_APICallError]: Cannot connect to API: Headers Timeout Error" when running with Ollama #13

Open
mikwee opened this issue Dec 29, 2024 · 0 comments

Comments

@mikwee
Copy link

mikwee commented Dec 29, 2024

I too am struggling with running Bolt locally. Every time I try to prompt it, it loads for ages until, at some point, it throws out this error:

lastError: APICallError [AI_APICallError]: Cannot connect to API: Headers Timeout Error
      at postToApi (/home/testuser/pinokio/api/bolt.git/app/node_modules/ollama-ai-provider/node_modules/@ai-sdk/provider-utils/src/post-to-api.ts:137:15)
      at OllamaChatLanguageModel.doStream (/home/testuser/pinokio/api/bolt.git/app/node_modules/ollama-ai-provider/src/ollama-chat-language-model.ts:230:50)
      at fn (file:///home/testuser/pinokio/api/bolt.git/app/node_modules/ai/core/generate-text/stream-text.ts:378:23)
      at file:///home/testuser/pinokio/api/bolt.git/app/node_modules/ai/core/telemetry/record-span.ts:18:22
      at _retryWithExponentialBackoff (file:///home/testuser/pinokio/api/bolt.git/app/node_modules/ai/util/retry-with-exponential-backoff.ts:37:12)
      at startStep (file:///home/testuser/pinokio/api/bolt.git/app/node_modules/ai/core/generate-text/stream-text.ts:333:13)
      at fn (file:///home/testuser/pinokio/api/bolt.git/app/node_modules/ai/core/generate-text/stream-text.ts:414:11)
      at file:///home/testuser/pinokio/api/bolt.git/app/node_modules/ai/core/telemetry/record-span.ts:18:22
      at chatAction (/home/testuser/pinokio/api/bolt.git/app/app/routes/api.chat.ts:63:20)
      at Object.callRouteAction (/home/testuser/pinokio/api/bolt.git/app/node_modules/@remix-run/server-runtime/dist/data.js:36:16)
      at /home/testuser/pinokio/api/bolt.git/app/node_modules/@remix-run/router/router.ts:4899:19
      at callLoaderOrAction (/home/testuser/pinokio/api/bolt.git/app/node_modules/@remix-run/router/router.ts:4963:16)
      at async Promise.all (index 0)
      at defaultDataStrategy (/home/testuser/pinokio/api/bolt.git/app/node_modules/@remix-run/router/router.ts:4772:17)
      at callDataStrategyImpl (/home/testuser/pinokio/api/bolt.git/app/node_modules/@remix-run/router/router.ts:4835:17)
      at callDataStrategy (/home/testuser/pinokio/api/bolt.git/app/node_modules/@remix-run/router/router.ts:3992:19)
      at submit (/home/testuser/pinokio/api/bolt.git/app/node_modules/@remix-run/router/router.ts:3755:21)
      at queryImpl (/home/testuser/pinokio/api/bolt.git/app/node_modules/@remix-run/router/router.ts:3684:22)
      at Object.queryRoute (/home/testuser/pinokio/api/bolt.git/app/node_modules/@remix-run/router/router.ts:3629:18)
      at handleResourceRequest (/home/testuser/pinokio/api/bolt.git/app/node_modules/@remix-run/server-runtime/dist/server.js:402:20)
      at requestHandler (/home/testuser/pinokio/api/bolt.git/app/node_modules/@remix-run/server-runtime/dist/server.js:156:18)
      at /home/testuser/pinokio/api/bolt.git/app/node_modules/@remix-run/dev/dist/vite/cloudflare-proxy-plugin.js:70:25 {
    cause: HeadersTimeoutError: Headers Timeout Error
        at FastTimer.onParserTimeout [as _onTimeout] (node:internal/deps/undici/undici:6193:32)
        at Timeout.onTick [as _onTimeout] (node:internal/deps/undici/undici:2210:17)
        at listOnTimeout (node:internal/timers:594:17)
        at processTimers (node:internal/timers:529:7) {
      code: 'UND_ERR_HEADERS_TIMEOUT'
    },
    url: 'http://localhost:11434/api/chat',
    requestBodyValues: {
      format: undefined,
      model: 'codegemma:latest',
      options: [Object],
      messages: [Array],
      tools: undefined
    },
    statusCode: undefined,
    responseHeaders: undefined,
    responseBody: undefined,
    isRetryable: true,
    data: undefined,
    [Symbol(vercel.ai.error)]: true,
    [Symbol(vercel.ai.error.AI_APICallError)]: true
  },
  [Symbol(vercel.ai.error)]: true,
  [Symbol(vercel.ai.error.AI_RetryError)]: true
}

Prompting Ollama outside of Bolt works fine. #9 didn't change anything. Is there anything else I can do? Thanks!

@mikwee mikwee changed the title Yet another Ollama issue "APICallError [AI_APICallError]: Cannot connect to API: Headers Timeout Error" when running with Ollama Dec 29, 2024
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

No branches or pull requests

1 participant