can1357/oh-my-pi · error · Error

Backblaze B2 bucket listing omitted buckets

Error message

Backblaze B2 bucket listing omitted buckets

What it means

When resolving a B2 bucket by name, the code calls b2_list_buckets and reads the `buckets` field of the response; if that field is missing or not an array, it throws this error because the listing cannot be iterated to find the bucket. This indicates the B2 API responded but not with the expected bucket-listing envelope.

Source

Thrown at packages/coding-agent/src/blob-broker/uploaders-object-storage.ts:505

		authorizationToken: requiredStringField(value, "authorizationToken", "Backblaze B2 authorization"),
		apiUrl: requiredStringField(value, "apiUrl", "Backblaze B2 authorization"),
		downloadUrl: requiredStringField(value, "downloadUrl", "Backblaze B2 authorization"),
	};
}

async function findB2Bucket(
	config: DestinationRuntimeConfig,
	authorization: B2Authorization,
	bucketName: string,
): Promise<B2Bucket> {
	const value = await b2Json(
		config,
		`${authorization.apiUrl}/b2api/v2/b2_list_buckets`,
		authorization.authorizationToken,
		{ accountId: authorization.accountId, bucketName },
	);
	const buckets = asRecord(value, "Backblaze B2 bucket listing").buckets;
	if (!Array.isArray(buckets)) throw new Error("Backblaze B2 bucket listing omitted buckets");
	for (const candidate of buckets) {
		if (optionalStringField(candidate, "bucketName") !== bucketName) continue;
		return {
			bucketId: requiredStringField(candidate, "bucketId", "Backblaze B2 bucket"),
			bucketName,
			bucketType: requiredStringField(candidate, "bucketType", "Backblaze B2 bucket"),
		};
	}
	throw new Error(`Backblaze B2 bucket not found: ${bucketName}`);
}

async function b2UploadTarget(
	config: DestinationRuntimeConfig,
	authorization: B2Authorization,
	bucketId: string,
): Promise<B2UploadTarget> {
	const value = await b2Json(
		config,

View on GitHub (pinned to 9690622007)

Solutions

  1. Re-authorize with b2_authorize_account and retry the listing with the fresh apiUrl/authorizationToken.
  2. Log the raw b2_list_buckets response body to see whether an error message replaced the buckets array.
  3. Verify the application key's capabilities include listBuckets and access to the target bucket.
  4. Check the B2 status page / retry in case of transient service issues.

Example fix

// before
// reusing a stale authorization for list_buckets
const value = await b2Call(authorization.apiUrl, ...);
// after
const authorization = await authorizeB2(config); // refresh token + apiUrl first
const value = await b2Call(authorization.apiUrl, ...);
Defensive patterns

Strategy: retry

Type guard

function isBucketListing(v: unknown): v is { buckets: unknown[] } {
  return typeof v === "object" && v !== null && Array.isArray((v as Record<string, unknown>).buckets);
}

Try / catch

try {
  const bucket = await findB2Bucket(config, authorization, bucketName);
} catch (err) {
  if (err instanceof Error && err.message.includes("omitted buckets")) {
    const fresh = await authorizeB2(config); // refresh token, then retry once
    return findB2Bucket(config, fresh, bucketName);
  } else throw err;
}

Prevention

When it happens

Trigger: b2_list_buckets responds with JSON that has no `buckets` array — e.g. an error object returned with a 200-ish status, an authorization token scoped such that the response shape differs, or an API/proxy issue returning a different payload.

Common situations: Expired/reviled authorization token used for the listing call; hitting the wrong apiUrl (stale authorization after token rotation); B2 service degradation returning an error envelope; account with API access but buckets listing disabled by key capabilities.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/05bc77113e8ee9a2. Report an issue: GitHub.