chatboxai/chatbox · error · Error
Invalid rerank model format: ${modelString}
Error message
Invalid rerank model format: ${modelString} What it means
Thrown by getSessionAttachmentRerankProvider when parseKnowledgeBaseModelString(modelString) returns null, meaning the rerank model string does not match the expected 'providerId:modelId' shape (or whatever grammar the parser enforces). Only reached when modelString is truthy, since a null/empty input short-circuits to return null (no reranking).
Source
Thrown at src/main/session-attachment-rag/model-providers.ts:76
export function getDefaultSessionAttachmentRerankModelString(): string | undefined {
const rerankModel = getDefaultRerankModelString(getSettings())
log.debug(`[MODEL] Default session attachment rerank model: ${rerankModel ?? 'none'}`)
return rerankModel
}
export async function getSessionAttachmentRerankProvider(modelString?: string | null) {
if (!modelString) {
return null
}
return cache(
`session-attachment-rag:rerank:${modelString}`,
async () => {
try {
const parsed = parseKnowledgeBaseModelString(modelString)
if (!parsed) {
throw new Error(`Invalid rerank model format: ${modelString}`)
}
const { providerId, modelId } = parsed
const settings = getSettings()
const { providerSetting, formattedApiHost } = getProviderSettings(
{
...settings,
provider: providerId,
modelId,
},
settings
)
let apiHost = formattedApiHost
let token = providerSetting.apiKey
if (providerId === 'chatbox-ai') {
apiHost = getChatboxAPIOrigin()
token = store.get('settings.licenseKey')View on GitHub (pinned to 81571269ad)
Solutions
- Re-enter the rerank model in settings as 'providerId:modelId' exactly as documented by parseKnowledgeBaseModelString.
- Trim and validate the string before saving it in settings.
- Leave the rerank model unset (null) to disable reranking rather than supplying a broken value.
- Unit-test the offending string against parseKnowledgeBaseModelString to see which grammar rule it violates.
Example fix
// before
const parsed = parseKnowledgeBaseModelString(modelString)
if (!parsed) throw new Error(`Invalid rerank model format: ${modelString}`)
// settings-save-time validation
const parsed = parseKnowledgeBaseModelString(input)
if (!parsed) { showFieldError('rerank model must be provider:model'); return } Defensive patterns
Strategy: validation
Validate before calling
const parsed = parseKnowledgeBaseModelString(modelString)
if (modelString && !parsed) { settings.rerankModel = null; warn('rerank model format invalid') } Type guard
function isInvalidRerankFormat(e: unknown): e is Error { return e instanceof Error && e.message.startsWith('Invalid rerank model format:') } Try / catch
try { return await getSessionAttachmentRerankProvider(modelString) } catch (e) { if (isInvalidRerankFormat(e)) { return null /* disable reranking */ } throw e } Prevention
- Validate the rerank string with parseKnowledgeBaseModelString at settings-save time.
- Leave rerank unset rather than supplying a broken value.
- Trim whitespace before storing.
When it happens
Trigger: User-configured rerank model string is malformed: missing colon, empty provider or model id, extra segments, or contains characters the parser rejects. The error is wrapped in the cache closure's try/catch, logged, reported to Sentry, and rethrown.
Common situations: Manual entry of a rerank model id with a typo; settings imported from an older format; copy-paste included whitespace or quotes; a UI field stored the display name instead of the canonical provider:model string.
Related errors
- Missing token for rerank provider: ${providerId}
- Session attachment ${id} not found
- Only failed session attachments can be retried
- Attachment content not found or empty
- Attachment did not produce any retrievable chunks
AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12).
Data as JSON: /api/errors/3708f5edd7ec238d.
Report an issue: GitHub.