ComposioHQ/composio · error · Error

Unsupported BetterSwiftAX constant fallback: ${constantName}

Error message

Unsupported BetterSwiftAX constant fallback: ${constantName}

What it means

This build script patches the vendored BetterSwiftAX checkout by rewriting kAX* constants into string literals. When a constant name does not match the expected kAX...(Attribute|Action|Role|...) naming pattern, the script cannot derive the corresponding "AX..." string and aborts.

Source

Thrown at ts/packages/cli-local-tools/scripts/build-beeper-imessage-binaries.ts:59

const betterSwiftAxFallbackFiles = [
  'Accessibility+Action.swift',
  'Accessibility+AttributeKey.swift',
  'Accessibility+Notification.swift',
  'Accessibility+ParameterizedAttributeKey.swift',
  'Accessibility+Role.swift',
  'Accessibility+Subrole.swift',
  'Accessibility+Value.swift',
] as const;

const betterSwiftAxConstantReferencePattern =
  /\bkAX[A-Za-z0-9]+(?:Action|ParameterizedAttribute|Attribute|Notification|Subrole|Role|Value)\b/g;
const betterSwiftAxConstantPattern =
  /^kAX(.+?)(Action|ParameterizedAttribute|Attribute|Notification|Subrole|Role|Value)$/;

const betterSwiftAxConstantLiteral = (constantName: string): string => {
  const match = betterSwiftAxConstantPattern.exec(constantName);
  if (!match) {
    throw new Error(`Unsupported BetterSwiftAX constant fallback: ${constantName}`);
  }
  return `"AX${match[1]}"`;
};

const ensurePlatform = () => {
  if (process.platform !== 'darwin') {
    throw new Error(
      'Building Beeper iMessage local-tool binaries requires macOS and the Swift toolchain.'
    );
  }
};

const ensureSubmodule = async () => {
  if (await exists(path.join(submodulePath, 'Package.swift'))) return;

  console.log(`Initializing ${submoduleRelativePath} submodule...`);
  await $`git submodule update --init --recursive -- ${submoduleRelativePath}`.cwd(repoRoot);

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Pin/restore the BetterSwiftAX revision the script was written against (git submodule update / Package.resolved).
  2. Extend betterSwiftAxConstantPattern and the literal mapping to cover the new constant suffix, mapping it to its correct "AX..." string.
  3. If the new SDK exposes the constants natively, exclude those symbols from the fallback file patch list.

Example fix

// before
const pattern = /^kAX(.+?)(Action|ParameterizedAttribute|Attribute|Notification|Subrole|Role|Value)$/;

// after
const pattern = /^kAX(.+?)(Action|ParameterizedAttribute|Attribute|Notification|Subrole|Role|Value|Error)$/;
Defensive patterns

Strategy: validation

Validate before calling

const ok = /^kAX(.+?)(Action|ParameterizedAttribute|Attribute|Notification|Subrole|Role|Value)$/.test(constantName);
if (!ok) throw new Error(`unsupported constant: ${constantName}`);

Type guard

const isSupportedKaxConstant = (n: string): boolean =>
  /^kAX(.+?)(Action|ParameterizedAttribute|Attribute|Notification|Subrole|Role|Value)$/.test(n);

Prevention

When it happens

Trigger: Running the Beeper iMessage binary build script after BetterSwiftAX introduced a kAX-prefixed symbol whose suffix is not one of Action|ParameterizedAttribute|Attribute|Notification|Subrole|Role|Value (e.g. kAXError or a new constant type).

Common situations: A newer BetterSwiftAX version is resolved by `swift package resolve` after a submodule/lockfile update, adding constants the fallback patcher doesn't recognize.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/9e23dd99fb3b3cdb. Report an issue: GitHub.