Kong/insomnia · error

Could not get folder by index ${folderIndex}. Must be betwee

Error message

Could not get folder by index ${folderIndex}. Must be between 0-${ancestors.length - 1}

What it means

Error "Could not get folder by index ${folderIndex}. Must be between 0-${ancestors.length - 1}" thrown in Kong/insomnia.

Source

Thrown at packages/insomnia/src/common/templating/local-template-tags.ts:995

          }
          if (attribute === 'oauth2') {
            return access.accessToken;
          }
          if (attribute === 'oauth2-identity') {
            return access.identityToken;
          }
          if (attribute === 'oauth2-refresh') {
            return access.refreshToken;
          }
        }
        if (attribute === 'name') {
          return request.name;
        }
        if (attribute === 'folder') {
          const ancestors = await context.util.models.request.getAncestors(request);
          const doc = ancestors[folderIndex || 0];
          if (!doc) {
            throw new Error(`Could not get folder by index ${folderIndex}. Must be between 0-${ancestors.length - 1}`);
          }
          return doc ? doc.name : null;
        }

        return null;
      },
    },
  },
];

export const localTemplateTags: TemplateTag[] = localTemplatePlugins.map(t => ({
  plugin: {
    name: t.templateTag.name,
    description: 'Built-in plugin',
    version: '0.0.0',
    directory: '',
    config: {
      disabled: false,

View on GitHub (pinned to d9bb2b0142)

When it happens

Trigger: Thrown at packages/insomnia/src/common/templating/local-template-tags.ts:995 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kong/insomnia@d9bb2b0142 (2026-08-26). Data as JSON: /api/errors/c2f8d992a390135a. Report an issue: GitHub.