janhq/jan · error

Model does not exist

Error message

Model ${modelId} does not exist

What it means

The delete() method builds the model directory path under the provider's models folder and requires a model.yml inside it; if that file is missing, it concludes no model with the given modelId exists and throws. It guards against deleting non-existent or corrupted model folders.

Solutions

  1. List installed models first and confirm the exact modelId before deleting
  2. Re-download/import the model if its model.yml is missing
  3. Guard the delete call with an existence check on the model list
  4. Correct the model ID spelling/case

Example fix

// before
await mlx.delete('my-model')
// after
const models = await mlx.getModels()
if (models.some(m => m.id === 'my-model')) {
  await mlx.delete('my-model')
}
Defensive patterns

Strategy: validation

Validate before calling

const models = await mlx.getModels()
const exists = models.some(m => m.id === modelId)
if (!exists) return // nothing to delete
await mlx.delete(modelId)

Type guard

const modelExists = (models, id) => Array.isArray(models) && models.some(m => m?.id === id)

Try / catch

try {
  await mlx.delete(modelId)
} catch (e) {
  if (String(e.message).includes('does not exist')) return // already gone: treat as idempotent
  throw e
}

Prevention

When it happens

Trigger: Calling delete(modelId) where <providerPath>/models/<modelId>/model.yml does not exist — wrong ID, model never imported, folder deleted manually, or the folder exists but model.yml was removed.

Common situations: Typos in model ID, deleting a model twice (second call fails), models created by older extension versions with a different layout, users cleaning the models directory by hand.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17). Data as JSON: /api/errors/739f5f0253ce6eb3. Report an issue: GitHub.

Appendix: source

Thrown at extensions/mlx-extension/src/index.ts:542

            throw new Error(error.message)
          }
        }
      }
    } finally {
      reader.releaseLock()
    }
  }

  override async delete(modelId: string): Promise<void> {
    const modelDir = await joinPath([
      await this.getProviderPath(),
      'models',
      modelId,
    ])

    const modelConfigPath = await joinPath([modelDir, 'model.yml'])
    if (!(await fs.existsSync(modelConfigPath))) {
      throw new Error(`Model ${modelId} does not exist`)
    }

    const modelConfig = await invoke<ModelConfig>('read_yaml', {
      path: modelConfigPath,
    })

    // Check if model_path is a relative path within mlx folder
    if (!isAbsoluteModelPath(modelConfig.model_path)) {
      // Model file is at {janDataFolder}/{model_path}
      // Delete the parent folder containing the actual model file
      const janDataFolderPath = await getJanDataFolderPath()
      const modelPath = await joinPath([
        janDataFolderPath,
        modelConfig.model_path,
      ])
      const parentDir = modelPath.substring(0, modelPath.lastIndexOf('/'))
      // Only delete if it's different from modelDir (i.e., not the same folder)
      if (parentDir !== modelDir) {

View on GitHub (pinned to 7205d770c1)