alibaba/open-code-review · error

config path not available

Error message

config path not available

What it means

Sentinel guard in applyEditCustomProviderSave: it fires when the TUI model was constructed without a config file path (e.g. running against defaults only), so persisting an edited custom provider has no destination. It is a precondition failure, not a save I/O error — the edit was never attempted on disk.

Source

Thrown at cmd/opencodereview/provider_tui.go:1344

	return out
}

func cloneCustomProviderList(src []customProviderListItem) []customProviderListItem {
	out := make([]customProviderListItem, len(src))
	for i, cp := range src {
		out[i] = customProviderListItem{name: cp.name, entry: cloneProviderEntry(cp.entry)}
	}
	return out
}

func (m *providerTUIModel) applyEditCustomProviderSave() error {
	if m.existingCfg == nil {
		m.formError = "failed to save: config not loaded"
		return fmt.Errorf("config not loaded")
	}
	if m.configPath == "" {
		m.formError = "failed to save: config path not available"
		return fmt.Errorf("config path not available")
	}
	r := m.result()
	backupProviders := cloneCustomProvidersMap(m.existingCfg.CustomProviders)
	backupActiveProvider := m.existingCfg.Provider
	backupActiveModel := m.existingCfg.Model
	backupCustomList := cloneCustomProviderList(m.customProviders)

	if m.existingCfg.CustomProviders == nil {
		m.existingCfg.CustomProviders = make(map[string]ProviderEntry)
	}
	entry := m.existingCfg.CustomProviders[r.editTargetName]
	if r.model != "" {
		entry.Model = r.model
	}
	if len(r.models) > 0 {
		entry.Models = append([]string(nil), r.models...)
	}
	entry.Models = ensureModelInList(entry.Models, r.model)

View on GitHub (pinned to 5cf97d0d15)

Solutions

  1. Start the provider TUI in a context where a config file path is known (config file present or creatable via --config)
  2. If you intentionally run config-less, do not attempt to edit/save custom providers
  3. Pass an explicit config path when launching ocr so edits have a target
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/opencodereview/provider_tui.go:1344 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02). Data as JSON: /api/errors/3c151ad952c4f891. Report an issue: GitHub.