weaviate/weaviate · error

join Mistral API host and path

Error message

join Mistral API host and path

What it means

This error wraps any failure from getMistralUrl while joining the Mistral API host and request path inside Generate. It means Weaviate could not construct a valid URL for the chat-completions endpoint, usually because a custom BaseURL set in the generative config failed validation or parsing. The wrapped cause (from url.JoinPath) describes the underlying parse problem.

Source

Thrown at modules/generative-mistral/clients/mistral.go:71

	}
	return v.Generate(ctx, cfg, forPrompt, options, debug)
}

func (v *mistral) GenerateAllResults(ctx context.Context, properties []*modulecapabilities.GenerateProperties, task string, options interface{}, debug bool, cfg moduletools.ClassConfig) (*modulecapabilities.GenerateResponse, error) {
	forTask, err := generative.MakeTaskPrompt(generative.Texts(properties), task)
	if err != nil {
		return nil, err
	}
	return v.Generate(ctx, cfg, forTask, options, debug)
}

func (v *mistral) Generate(ctx context.Context, cfg moduletools.ClassConfig, prompt string, options interface{}, debug bool) (*modulecapabilities.GenerateResponse, error) {
	params := v.getParameters(cfg, options)
	debugInformation := v.getDebugInformation(debug, prompt)

	mistralUrl, err := v.getMistralUrl(ctx, params.BaseURL)
	if err != nil {
		return nil, errors.Wrap(err, "join Mistral API host and path")
	}

	message := Message{
		Role:    "user",
		Content: prompt,
	}

	input := generateInput{
		Messages:    []Message{message},
		Model:       params.Model,
		Temperature: params.Temperature,
		TopP:        params.TopP,
		MaxTokens:   params.MaxTokens,
	}

	body, err := json.Marshal(input)
	if err != nil {
		return nil, errors.Wrap(err, "marshal body")

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Fix the baseURL in the generative parameters to include a scheme, e.g. https://api.mistral.ai/v1
  2. Remove the custom baseURL to fall back to the default Mistral API host
  3. Check the wrapped error message for the exact URL parse failure
  4. Validate the URL in your client config before issuing the query

Example fix

// before
{ "mistral": { "baseURL": "localhost:8000/v1" } }
// after
{ "mistral": { "baseURL": "http://localhost:8000/v1" } }
Defensive patterns

Strategy: validation

Validate before calling

u, err := url.Parse(baseURL)
if err != nil || u.Scheme == "" || u.Host == "" {
    return fmt.Errorf("invalid mistral baseURL %q: %w", baseURL, err)
}

Try / catch

// GraphQL client surfaces the error in the returned error field
resp, err := client.Query(ctx, q)
if err != nil && strings.Contains(err.Error(), "join Mistral API host and path") {
    // fix baseURL in moduleConfig and retry
}

Prevention

When it happens

Trigger: Calling nearText/nearVector with generative-mistral configured while params.BaseURL is a malformed URL (missing scheme, invalid characters), or getMistralUrl returning err for cross-class requests with an unusable base URL.

Common situations: Users set generative: {mistral: {baseURL: 'localhost:8000'}} without the http(s):// scheme, or typo a proxy URL, or pass a non-string base URL from application config.

Understand the failure class

Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/7c8e7c3950ebcd4d. Report an issue: GitHub.