{"record":{"id":"fec1ba63cb852acc","repo":"Tencent/WeKnora","slug":"errsandboxconfigcordoned","errorCode":"ErrSandboxConfigCordoned","errorMessage":"%w: %s","messagePattern":"%w: %s","errorType":"error_code","errorClass":"ErrSandboxConfigCordoned","httpStatus":null,"severity":"error","filePath":"internal/sandbox/tenant_resolver.go","lineNumber":171,"sourceCode":"\tctx context.Context,\n\ttenantID uint64,\n\tconfigID string,\n) (Manager, error) {\n\tif strings.TrimSpace(configID) == \"\" ||\n\t\tconfigID == types.SandboxConfigIDGlobalDefault {\n\t\treturn NewDisabledManager(), nil\n\t}\n\n\tresolved, err := r.deps.Loader.Load(ctx, tenantID, configID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"sandbox: load workspace %d config %q: %w\", tenantID, configID, err)\n\t}\n\tif !resolved.Found {\n\t\treturn nil, fmt.Errorf(\"%w: %s\", ErrSandboxConfigNotFound, configID)\n\t}\n\tif resolved.Cordoned {\n\t\treturn nil, fmt.Errorf(\"%w: %s\", ErrSandboxConfigCordoned, configID)\n\t}\n\n\teffective, err := ResolveEffectiveConfig(resolved.Config, r.deps.GlobalConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := EnsureDockerBackendAllowed(effective.Type); err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch effective.Type {\n\tcase SandboxTypeDisabled:\n\t\treturn NewDisabledManager(), nil\n\tcase SandboxTypeCube, SandboxTypeE2B, SandboxTypeDocker:\n\t\tclient, err := r.buildClient(effective)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/tenant_resolver.go#L153-L189","documentation":"After loading a workspace sandbox config, Resolve checks resolved.Cordoned. A cordoned config is administratively disabled (e.g. pending review or quarantined) and must not be used, so Resolve returns this sentinel-wrapped error (ErrSandboxConfigCordoned) with the config ID.","triggerScenarios":"Calling Resolve on a tenantID/configID whose stored config row has the cordoned flag set — regardless of the config's contents being otherwise valid.","commonSituations":"Ops team cordoning a config due to a security incident or bad template; environments (staging/prod) sharing a database where a config was cordoned elsewhere; automated pipelines still referencing a cordoned config.","solutions":["Ask an administrator to uncordon the config, or pick a different, active config ID.","Check errors.Is(err, sandbox.ErrSandboxConfigCordoned) and route to a fallback/default sandbox config.","Surface a clear status to the tenant that their sandbox config is temporarily disabled."],"exampleFix":"// before\ncfg, err := resolver.Resolve(ctx, tenantID, cfgID)\nreturn cfg, err\n// after\ncfg, err := resolver.Resolve(ctx, tenantID, cfgID)\nif errors.Is(err, sandbox.ErrSandboxConfigCordoned) {\n    return resolver.Resolve(ctx, tenantID, fallbackConfigID)\n}","handlingStrategy":"try-catch","validationCode":"// query the config's status before resolving\nst, _ := client.GetWorkspaceConfigStatus(ctx, tenantID, configID)\nif st == \"cordoned\" { /* switch to fallback config */ }","typeGuard":null,"tryCatchPattern":"cfg, err := resolver.Resolve(ctx, tenantID, configID)\nif errors.Is(err, sandbox.ErrSandboxConfigCordoned) {\n    return resolver.Resolve(ctx, tenantID, fallbackConfigID)\n}\nif err != nil { return err }","preventionTips":["Maintain an always-active fallback config per tenant.","Monitor cordoned configs and alert the owning team.","Check config status in health checks, not only at request time."],"tags":["configuration","multi-tenant","policy"],"backgroundTag":"resource-cordoned","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}