{"record":{"id":"85bcabe0f285ff5d","repo":"Billionmail/BillionMail","slug":"models-file-does-not-exist-for-supplier","errorCode":null,"errorMessage":"models file does not exist for supplier: ","messagePattern":"models file does not exist for supplier: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/askai/supplier.go","lineNumber":647,"sourceCode":"\tif public.FileExists(templatePath) {\n\t\treturn errors.New(\"Cannot delete the system's built-in model supplier.\")\n\t}\n\n\terr := os.RemoveAll(supplierPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\n// SetModelTitle updates the title of a model in the supplier's models.json file.\n// It reads the existing models, modifies the title of the specified model, and saves the updated list back to the file.\n// If the model is not found, it returns an error indicating that the model does not exist.\nfunc SetModelTitle(supplierName string, modelId string, title string) error {\n\tmodelsFile := SUPPLIER_CONFIG_PATH + \"/\" + supplierName + \"/models.json\"\n\tif !public.FileExists(modelsFile) {\n\t\treturn errors.New(\"models file does not exist for supplier: \" + supplierName)\n\t}\n\n\t// Read existing models\n\texistingModels := GetModelList(supplierName)\n\n\t// Update the model title\n\tfor i, model := range existingModels {\n\t\tif model.ModelId == modelId {\n\t\t\texistingModels[i].Title = title\n\t\t\treturn saveModelsToFile(modelsFile, existingModels)\n\t\t}\n\t}\n\n\treturn errors.New(\"model not found\")\n}\n\n// SetModelCapability updates the capability of a specific model in the supplier's models.json file.\n// It reads the existing models, modifies the capability of the specified model, and saves the updated list back to the file.","sourceCodeStart":629,"sourceCodeEnd":665,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/askai/supplier.go#L629-L665","documentation":"SetModelTitle requires the supplier's models.json to exist, since it edits entries in that file. If SUPPLIER_CONFIG_PATH/<supplierName>/models.json is missing, it aborts with this error naming the supplier.","triggerScenarios":"Calling SetModelTitle for a supplier whose config directory exists but has no models.json — e.g. a freshly created supplier whose model list was never fetched/saved.","commonSituations":"Calling model-update APIs before the model list has been initialized; supplier name typo pointing at a non-existent/empty config dir; models.json deleted manually or lost during a failed sync.","solutions":["Call GetModelList / the supplier's model-fetch routine to create models.json before editing titles","Verify the supplierName is correct and its config directory contains models.json","If the models file was deleted, re-fetch models from the supplier API to regenerate it"],"exampleFix":"// before\nerr := SetModelTitle(\"mycust\", \"gpt-4o\", \"My GPT\") // no models.json yet\n\n// after\nif !public.FileExists(SUPPLIER_CONFIG_PATH + \"/mycust/models.json\") {\n    RefreshModelList(\"mycust\") // create models.json first\n}\nerr := SetModelTitle(\"mycust\", \"gpt-4o\", \"My GPT\")","handlingStrategy":"validation","validationCode":"modelsFile := SUPPLIER_CONFIG_PATH + \"/\" + supplierName + \"/models.json\"\nif !public.FileExists(modelsFile) {\n    return errors.New(\"run model list sync for \" + supplierName + \" first\")\n}\nreturn SetModelTitle(supplierName, modelId, title)","typeGuard":null,"tryCatchPattern":"if err := SetModelTitle(supplier, id, title); err != nil {\n    if strings.Contains(err.Error(), \"models file does not exist\") {\n        // trigger model-list refresh then retry once\n    } else { return err }\n}","preventionTips":["Always initialize a supplier's models.json right after AddSupplier","Gate model-edit operations behind a models-file existence check","Monitor for suppliers with missing models.json"],"tags":["configuration","file-not-found","ai-supplier"],"backgroundTag":"model-file-missing","analyzedSha":"fc36c76c050c3775c5e899faf7403cf0262d2744","analyzedAt":"2026-09-05T21:28:54.019Z","contentChangedAt":"2026-09-05T21:28:54.019Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}