Tencent/WeKnora · error

sandbox: provider %q returned no standard template

Error message

sandbox: provider %q returned no standard template

What it means

Result guard in QueryTemplates: the ensure/replace call on the provider's template catalog returned a value that is nil or not a *sandbox.RemoteTemplate, i.e. the provider failed to produce a standard template without returning a Go error. A malformed provider response, keyed by the sandbox provider identity.

Source

Thrown at internal/application/service/tenant_sandbox_config.go:654

	wantStandard := in.ReplaceStandard || (in.EnsureStandard && usable == nil)
	if wantStandard {
		op := "ensure"
		if in.ReplaceStandard {
			op = "replace"
		}
		key := op + ":" + ensureTemplateKey(tenantID, sandbox.IdentityOf(merged))
		ensured, ensureErr, _ := s.ensureTemplate.Do(key, func() (any, error) {
			if in.ReplaceStandard {
				return catalog.ReplaceStandardTemplate(ctx)
			}
			return catalog.EnsureStandardTemplate(ctx)
		})
		if ensureErr != nil {
			return nil, ensureErr
		}
		standard, ok := ensured.(*sandbox.RemoteTemplate)
		if !ok || standard == nil {
			return nil, fmt.Errorf("sandbox: provider %q returned no standard template", effective.Type)
		}
		result.Templates = deduplicateSandboxTemplates(append(result.Templates, *standard))
		if sandbox.IsTemplateReady(standard.Status) {
			result.Provisioned = true
			if in.ReplaceStandard {
				persistErr := s.persistSpawnTemplateID(ctx, tenantID, merged, standard.ID, oldStandardIDs)
				if persistErr != nil {
					logger.Warnf(ctx, "[sandbox] persist rebuilt template id: %v; keeping previous templates",
						persistErr)
				} else {
					result.StandardTemplateID = standard.ID
					result.Templates = hideSupersededStandardTemplates(result.Templates, standard.ID)
					s.deleteSupersededStandardTemplates(ctx, catalog, standard.ID)
				}
			} else {
				result.StandardTemplateID = standard.ID
			}
		} else if !sandbox.IsTemplateBuildFailed(standard.Status) {

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Retry the template ensure/replace operation (singleflight-keyed, transient provider flakiness)
  2. Check the sandbox provider's health and template API response shape
  3. File a provider bug if it persistently returns empty standard templates
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at internal/application/service/tenant_sandbox_config.go:654 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/f431f6c4292e72c4. Report an issue: GitHub.