OtterMind/Chat2DB · warning · Error

Pricing is disabled in community mode

Error message

Pricing is disabled in community mode

What it means

In service/misc.ts, createOrder is conditionally replaced with a throwing async function when __RUNTIME_ENV__ === 'community'. The real createOrder calls POST /api/pay/create_order; the Community stub throws 'Pricing is disabled in community mode'. This is the same product-contract boundary as the dedicated pricing service but centralized in the misc service module for order creation specifically.

Source

Thrown at chat2db-community-client/src/service/misc.ts:12

import { BucketTypeEnum, UploadTypeEnum } from '@/typings/upload';
import createRequest from './base';
import { OrderDetail, CreateOrderResponse } from '@/typings/pricing';

const testService = createRequest<null, boolean>('/api/system', { errorLevel: false });
const systemStop = createRequest<void, void>('/api/system/stop', { errorLevel: false, method: 'post' });
const testApiSmooth = createRequest<void, void>('/api/system/get-version-a', { errorLevel: false, method: 'get' });
const uploadFile = createRequest<any, string>('/api/file/upload', { method: 'post' });
const createOrder =
  __RUNTIME_ENV__ === 'community'
    ? async () => {
        throw new Error('Pricing is disabled in community mode');
      }
    : createRequest<{ id: number; seats?: number; invitationCode?: string }, CreateOrderResponse>(
        '/api/pay/create_order',
        { method: 'get' },
      );
const getOrder =
  __RUNTIME_ENV__ === 'community'
    ? async () => {
        throw new Error('Pricing is disabled in community mode');
      }
    : createRequest<{ orderId: string }, OrderDetail>('/api/pay/get_order_status_a', { method: 'get' });

/** Upload CSS */
const getOSSCertificate = createRequest<
  {
    bucketType: BucketTypeEnum;
    uploadType: UploadTypeEnum;
  },

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Gate createOrder call sites behind __RUNTIME_ENV__ !== 'community'.
  2. Hide/disable the upgrade and billing UI in Community builds.
  3. Wrap in try/catch and show 'not available in Community edition' on error.

Example fix

// before
const result = await createOrder({ id, seats });

// after
if (__RUNTIME_ENV__ === 'community') {
  message.info('Billing is not available in Community edition');
  return;
}
const result = await createOrder({ id, seats });
Defensive patterns

Strategy: validation

Validate before calling

if (__RUNTIME_ENV__ === 'community') {
  message.info('Order creation is not available in Community edition');
  return;
}
await createOrder({ id, seats });

Prevention

When it happens

Trigger: Calling createOrder({ id, seats, invitationCode }) in a Community build. This is typically triggered by a billing/upgrade flow or a pricing modal that wasn't gated behind an edition check.

Common situations: A shared upgrade button visible in Community. A billing page reachable via deep link in Community. Code refactored from Enterprise without auditing createOrder call sites.

Related errors


AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14). Data as JSON: /api/errors/0efb657ae99fc4c6. Report an issue: GitHub.