thanos-io/thanos · error
get tenant appendable
Error message
get tenant appendable
What it means
Error from Thanos receive Writer.Write: the multi-TSDB could not return an Appendable for the given tenant (multiTSDB.TenantAppendable failed). This usually means the tenant is unknown/not allowed, the tenant ID is invalid, or the per-tenant TSDB cannot be opened/created.
Solutions
- Check the wrapped cause to see if it is tenant validation or TSDB open failure.
- Verify the tenant ID against the receive --receive.tenant-header / allowed tenants config and fix the sender's header value.
- Ensure the TSDB data directory is writable and has disk space.
- Confirm the multiTSDB was initialized with the tenant (hashrings/replication config) before writes.
Example fix
// before: arbitrary tenant from header
tenant := r.Header.Get("X-Scope-OrgID") // "foo bar" (invalid)
// after: validate against allowlist
if !allowedTenants[tenant] { http.Error(w, "unknown tenant", 400); return } Defensive patterns
Strategy: validation
Validate before calling
if tenant == "" || !validTenantRegex.MatchString(tenant) {
return errors.New("invalid or missing tenant ID")
}
if !allowedTenants[tenant] { return fmt.Errorf("tenant %q not allowed", tenant) } Try / catch
if err := writer.Write(ctx, tenant, series); err != nil {
if strings.Contains(err.Error(), "get tenant appendable") {
// reject request with 400/404, do not retry against same tenant
}
} Prevention
- Validate tenant header against allowlist before routing
- Use a strict tenant ID regex (no slashes/spaces)
- Keep hashring/tenant config in sync between router and receiver
When it happens
Trigger: Writer.Write called with a tenantID for which TenantAppendable returns an error - e.g. tenant not matching allowed tenants configuration, illegal tenant label characters, or failure opening/creating the tenant's TSDB directory.
Common situations: Remote-write senders using a tenant header (e.g. thanos tenant: X-Scope-OrgID) that isn't in the receiver's allowed list; typo'd tenant IDs; disk/permission problems preventing per-tenant TSDB creation.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/05dc17c1d16dfee9.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/receive/writer.go:79
}
func NewWriter(logger log.Logger, multiTSDB TenantStorage, opts *WriterOptions) *Writer {
if opts == nil {
opts = &WriterOptions{}
}
return &Writer{
logger: logger,
multiTSDB: multiTSDB,
opts: opts,
}
}
func (r *Writer) Write(ctx context.Context, tenantID string, wreq []prompb.TimeSeries) error {
tLogger := log.With(r.logger, "tenant", tenantID)
s, err := r.multiTSDB.TenantAppendable(tenantID)
if err != nil {
return errors.Wrap(err, "get tenant appendable")
}
app, err := s.Appender(ctx)
if err == tsdb.ErrNotReady {
return err
}
if err != nil {
return errors.Wrap(err, "get appender")
}
getRef := app.(storage.GetRef)
var (
ref storage.SeriesRef
errorTracker writeErrorTracker
)
app = &ReceiveAppender{
tLogger: tLogger,
tooFarInFuture: r.opts.TooFarInFutureTimeWindow,
Appender: app,View on GitHub (pinned to 35b8b99117)