Tencent/WeKnora · error

sandbox config is being modified by another request

Error message

sandbox config is being modified by another request

What it means

Sentinel ErrSandboxConfigCordoned returned by SetCordon when a compare-and-set style UPDATE affects 0 rows — meaning another request already holds a fresh cordon lease on the same sandbox config row. A concurrency-control signal, not a data error; the handler responds with a cordon-conflict response.

Source

Thrown at internal/application/repository/tenant_sandbox_config.go:120

			"name":         e.Name,
			"description":  e.Description,
			"sandbox_type": e.SandboxType,
			"config":       e.Config,
			"updated_at":   time.Now(),
		}).Error
}

func (r *tenantSandboxConfigRepository) SoftDelete(
	ctx context.Context, tenantID uint64, id string,
) error {
	return r.db.WithContext(ctx).
		Where("tenant_id = ? AND id = ?", tenantID, id).
		Delete(&types.TenantSandboxConfigEntity{}).Error
}

// ErrSandboxConfigCordoned is returned by SetCordon when another request
// already holds a fresh cordon lease on the same config row.
var ErrSandboxConfigCordoned = errors.New("sandbox config is being modified by another request")

// SetCordon must be committed before the caller lists provider sandboxes:
// resolution paths only stop creating sandboxes once they can see it.
//
// The update is a conditional CAS: it refuses to overwrite a cordon that is
// still within the lease window, so two concurrent identity-change requests
// cannot race past each other.
func (r *tenantSandboxConfigRepository) SetCordon(
	ctx context.Context, tenantID uint64, id string, at time.Time,
) error {
	result := r.db.WithContext(ctx).
		Model(&types.TenantSandboxConfigEntity{}).
		Where("tenant_id = ? AND id = ?", tenantID, id).
		Where("cordoned_at IS NULL OR cordoned_at < ?", at.Add(-types.SandboxCordonLease)).
		Update("cordoned_at", at)
	if result.Error != nil {
		return result.Error
	}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Treat the config as already cordoned; poll or read the current cordon state instead of re-issuing
  2. Retry cordon after the existing lease expires if a fresh cordon is genuinely needed
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/application/repository/tenant_sandbox_config.go:120 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/704d0f3ed40b30ea. Report an issue: GitHub.