weaviate/weaviate · error
create POST request
Error message
create POST request
What it means
This error is returned by the text2vec-ollama client when http.NewRequestWithContext fails to construct the POST request to the Ollama /api/embed endpoint (ollama.go:79). NewRequestWithContext only errors on an invalid HTTP method (never the case here, "POST" is hardcoded) or an unparsable URL, so in practice this wrapper almost always indicates a malformed apiEndpoint configured for the module. The error message is wrapped with pkg/errors so the underlying url.Parse error text is preserved in the chain.
Solutions
- Fix the apiEndpoint to include a full scheme and host, e.g. "http://localhost:11434".
- Check the wrapped error text after 'create POST request:' — it names the exact URL parse failure (e.g. 'parse "localhost:11434/api/embed": missing protocol scheme').
- Verify the value is set where you think it is: environment variable TEXT2VEC_OLLAMA_API_ENDPOINT vs per-class moduleConfig in the collection schema; class settings win.
- If using Weaviate in Docker, remember localhost from inside the container is not the host; use http://host.docker.internal:11434 or the service name.
Example fix
// before (invalid, no scheme)
{
"moduleConfig": {
"text2vec-ollama": {
"apiEndpoint": "localhost:11434"
}
}
}
// after
{
"moduleConfig": {
"text2vec-ollama": {
"apiEndpoint": "http://localhost:11434"
}
}
} Defensive patterns
Strategy: validation
Validate before calling
func validateOllamaEndpoint(endpoint string) error {
if endpoint == "" {
return fmt.Errorf("text2vec-ollama apiEndpoint is empty")
}
u, err := url.Parse(endpoint)
if err != nil {
return fmt.Errorf("invalid apiEndpoint %q: %w", endpoint, err)
}
if u.Scheme != "http" && u.Scheme != "https" {
return fmt.Errorf("apiEndpoint %q must start with http:// or https://", endpoint)
}
if u.Host == "" {
return fmt.Errorf("apiEndpoint %q is missing a host", endpoint)
}
return nil
} Prevention
- Always specify the full URL including scheme and port: http://localhost:11434 or http://ollama:11434.
- Validate the endpoint with the function above or a curl one-liner before creating collections with the module enabled.
- Keep the endpoint in one place (env var or config template) rather than ad-hoc per-class values to avoid drift.
- Remember class-level moduleConfig overrides the module-wide env var — check the schema if a fix 'doesn't take effect'.
When it happens
Trigger: Occurs during vectorize (called from Vectorize and VectorizeQuery) when the configured apiEndpoint from class settings cannot be parsed as a URL — e.g. an empty string, "localhost:11434" without a scheme, containing spaces, or otherwise invalid URL characters. It fires synchronously before any network traffic is attempted.
Common situations: Users setting TEXT2VEC_OLLAMA_API_ENDPOINT or the per-class moduleConfig apiEndpoint to a host without the http:// or https:// scheme, leaving the setting empty, or copy-pasting an endpoint with a trailing space or stray character. Also seen when misconfiguring a custom Ollama proxy URL.
Related errors
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/70fee59d3771d803.
Report an issue: GitHub.
Appendix: source
Thrown at modules/text2vec-ollama/clients/ollama.go:79
func (v *ollama) vectorize(ctx context.Context, input []string,
cfg moduletools.ClassConfig,
) (*modulecomponents.VectorizationResult[[]float32], error) {
settings := ent.NewClassSettings(cfg)
body, err := json.Marshal(embeddingsRequest{
Model: settings.Model(),
Input: input,
})
if err != nil {
return nil, errors.Wrapf(err, "marshal body")
}
endpointURL := v.urlBuilderFn(settings.ApiEndpoint())
req, err := http.NewRequestWithContext(ctx, "POST", endpointURL,
bytes.NewReader(body))
if err != nil {
return nil, errors.Wrap(err, "create POST request")
}
res, err := v.httpClient.Do(req)
if err != nil {
return nil, errors.Wrap(err, "send POST request")
}
defer res.Body.Close()
bodyBytes, err := io.ReadAll(res.Body)
if err != nil {
return nil, errors.Wrap(err, "read response body")
}
return v.parseEmbeddingsResponse(res.StatusCode, bodyBytes, input)
}
func (v *ollama) parseEmbeddingsResponse(statusCode int,
bodyBytes []byte, input []string,View on GitHub (pinned to 75aa4b6d11)