From 451602d1e61256696f6bcb0cd76f09748345a940 Mon Sep 17 00:00:00 2001 From: Meier Lukas Date: Fri, 13 Mar 2026 14:09:30 +0100 Subject: [PATCH] fix(true-nas): ignore offline/exported pools (#5225) --- .../src/truenas/truenas-integration.ts | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/packages/integrations/src/truenas/truenas-integration.ts b/packages/integrations/src/truenas/truenas-integration.ts index 4ff38d819..a712bc076 100644 --- a/packages/integrations/src/truenas/truenas-integration.ts +++ b/packages/integrations/src/truenas/truenas-integration.ts @@ -126,11 +126,28 @@ export class TrueNasIntegration extends Integration implements ISystemHealthMoni }, ]); const result = await poolSchema.parseAsync(response); + // Offline / exported pools have null values for allocated, size and free, so we filter them out + // See https://github.com/homarr-labs/homarr/issues/5194 + const activePools = result + .map((pool) => { + if (pool.allocated !== null && pool.size !== null && pool.free !== null) { + return { + ...pool, + allocated: pool.allocated, + size: pool.size, + free: pool.free, + }; + } + + return null; + }) + .filter((pool) => pool !== null); logger.debug("Retrieved pools", { url: this.wsUrl(), - count: result.length, + totalCount: result.length, + activeCount: activePools.length, }); - return result; + return activePools; } /** @@ -388,9 +405,11 @@ const poolSchema = z.array( name: z.string(), status: z.string(), healthy: z.boolean(), - free: z.number().min(0), - size: z.number(), - allocated: z.number(), + // free, size and allocated are null when the pool is offline or exported + // see https://github.com/homarr-labs/homarr/issues/5194 + free: z.number().min(0).nullable(), + size: z.number().nullable(), + allocated: z.number().nullable(), }), );