plandex-ai/plandex · error

error hashing models: %v

Error message

error hashing models: %v

What it means

CustomModelsCheckLocalChanges computes a hash of the local ModelsInput via localModelsInput.Hash(); a hashing failure is wrapped as 'error hashing models: %v'. Hashing depends on serializing the model input, so this indicates the in-memory data cannot be canonicalized.

Source

Thrown at app/cli/lib/custom_models.go:126

	}

	var localClientModelsInput shared.ClientModelsInput
	err = json.Unmarshal(localJsonData, &localClientModelsInput)
	if err != nil {
		return CustomModelsCheckLocalChangesResult{}, fmt.Errorf("error unmarshalling JSON file: %v", err)
	}

	localModelsInput := localClientModelsInput.ToModelsInput()

	lastSavedHash, err := os.ReadFile(hashPath)

	if err != nil && !os.IsNotExist(err) {
		return CustomModelsCheckLocalChangesResult{}, fmt.Errorf("error reading hash file: %v", err)
	}

	currentHash, err := localModelsInput.Hash()
	if err != nil {
		return CustomModelsCheckLocalChangesResult{}, fmt.Errorf("error hashing models: %v", err)
	}

	return CustomModelsCheckLocalChangesResult{
		HasLocalChanges:  currentHash != string(lastSavedHash),
		LocalModelsInput: localModelsInput,
	}, nil
}

func WriteCustomModelsFile(path string, modelsInput *shared.ModelsInput) error {
	err := os.MkdirAll(filepath.Dir(path), 0755)
	if err != nil {
		return fmt.Errorf("error creating directory: %v", err)
	}

	clientModelsInput := modelsInput.ToClientModelsInput()
	clientModelsInput.PrepareUpdate()

	jsonData, err := json.MarshalIndent(clientModelsInput, "", "  ")

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check the wrapped hash error for the failing serialization reason
  2. Fix or remove the offending custom model/provider entries in the local JSON
  3. Delete local custom-models state and resync from the server to rebuild a clean input
  4. If reproducible with valid data, report/inspect the Hash implementation for the unsupported case

Example fix

// before
currentHash, err := localModelsInput.Hash()
if err != nil {
    return CustomModelsCheckLocalChangesResult{}, fmt.Errorf("error hashing models: %v", err)
}
// after: caller resyncs on hash failure
if _, err := localModelsInput.Hash(); err != nil {
    return SyncCustomModels() // rebuild local state from server
}
Defensive patterns

Strategy: fallback

Validate before calling

if len(input.CustomModels) == 0 && len(input.CustomProviders) == 0 {
    return // nothing to hash; skip comparison
}

Try / catch

res, err := CustomModelsCheckLocalChanges(...)
if err != nil && strings.Contains(err.Error(), "error hashing models") {
    // local input is unusable — rebuild it from the server
    return SyncCustomModels()
}

Prevention

When it happens

Trigger: localModelsInput.Hash() returns an error — e.g. the serialization step inside Hash fails because some model/provider entry in the local input cannot be marshalled deterministically (nil/invalid nested data).

Common situations: Corrupt or partially parsed entries from a malformed local JSON (feeding into the input); custom model definitions with unsupported field values; a bug/edge case in the Hash implementation for unusual model shapes.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/f5b3f3c4406ca88c. Report an issue: GitHub.