{"record":{"id":"7c8e7c3950ebcd4d","repo":"weaviate/weaviate","slug":"join-mistral-api-host-and-path","errorCode":null,"errorMessage":"join Mistral API host and path","messagePattern":"join Mistral API host and path","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/generative-mistral/clients/mistral.go","lineNumber":71,"sourceCode":"\t}\n\treturn v.Generate(ctx, cfg, forPrompt, options, debug)\n}\n\nfunc (v *mistral) GenerateAllResults(ctx context.Context, properties []*modulecapabilities.GenerateProperties, task string, options interface{}, debug bool, cfg moduletools.ClassConfig) (*modulecapabilities.GenerateResponse, error) {\n\tforTask, err := generative.MakeTaskPrompt(generative.Texts(properties), task)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn v.Generate(ctx, cfg, forTask, options, debug)\n}\n\nfunc (v *mistral) Generate(ctx context.Context, cfg moduletools.ClassConfig, prompt string, options interface{}, debug bool) (*modulecapabilities.GenerateResponse, error) {\n\tparams := v.getParameters(cfg, options)\n\tdebugInformation := v.getDebugInformation(debug, prompt)\n\n\tmistralUrl, err := v.getMistralUrl(ctx, params.BaseURL)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"join Mistral API host and path\")\n\t}\n\n\tmessage := Message{\n\t\tRole:    \"user\",\n\t\tContent: prompt,\n\t}\n\n\tinput := generateInput{\n\t\tMessages:    []Message{message},\n\t\tModel:       params.Model,\n\t\tTemperature: params.Temperature,\n\t\tTopP:        params.TopP,\n\t\tMaxTokens:   params.MaxTokens,\n\t}\n\n\tbody, err := json.Marshal(input)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"marshal body\")","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/modules/generative-mistral/clients/mistral.go#L53-L89","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the baseURL in the generative parameters to include a scheme, e.g. https://api.mistral.ai/v1","Remove the custom baseURL to fall back to the default Mistral API host","Check the wrapped error message for the exact URL parse failure","Validate the URL in your client config before issuing the query"],"exampleFix":"// before\n{ \"mistral\": { \"baseURL\": \"localhost:8000/v1\" } }\n// after\n{ \"mistral\": { \"baseURL\": \"http://localhost:8000/v1\" } }","handlingStrategy":"validation","validationCode":"u, err := url.Parse(baseURL)\nif err != nil || u.Scheme == \"\" || u.Host == \"\" {\n    return fmt.Errorf(\"invalid mistral baseURL %q: %w\", baseURL, err)\n}","typeGuard":null,"tryCatchPattern":"// GraphQL client surfaces the error in the returned error field\nresp, err := client.Query(ctx, q)\nif err != nil && strings.Contains(err.Error(), \"join Mistral API host and path\") {\n    // fix baseURL in moduleConfig and retry\n}","preventionTips":["Always include http:// or https:// in custom baseURL values","Test generative config on a dev collection before production","Omit baseURL unless running a custom/proxied endpoint"],"tags":["url","configuration","generative-mistral"],"backgroundTag":"invalid-url","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}