jeecgboot/JeecgBoot · error · Error

地址错误, 配置ID不存在!

Error message

地址错误, 配置ID不存在!

What it means

Setup guard in the auto-style online cgform list component. `ID` is the online form code, sourced from `params.code ?? ''` in `useOnlineTableContext()`. At setup, if `ID.value` is empty it warns the user then throws to abort further rendering, because every later column/data/button-config API call needs that code.

Source

Thrown at jeecgboot-vue3/src/views/super/online/cgform/auto/default/OnlineAutoList.vue:259

        getColumnList,
        handleChangeInTable,
        loadData,
        superQueryButtonRef,
        superQueryStatus,
        handleSuperQuery,
        onlineExtConfigJson,
        handleFormConfig,
        registerCustomModal,
        tableReloading,
        isConfigCurRoute,
        pageLoading,
      } = useOnlineTableContext();

      // 判断 若ID不存在就终止后续逻辑
      if (!ID.value) {
        $message.warning('地址错误, 配置ID不存在!');
        // update-end--author:liaozhiyang---date:20230825---for:【QQYUN-6326】部分代码找不到引用
        throw new Error('地址错误, 配置ID不存在!');
        // update-end--author:liaozhiyang---date:20230825---for:【QQYUN-6326】部分代码找不到引用
      }
      // 处理增强
      let { initCgEnhanceJs } = useEnhance(onlineTableContext);
      // 处理列表button
      const {
        buttonSwitch,
        cgLinkButtonList,
        cgBIBtnMap,
        getQueryButtonCfg,
        getResetButtonCfg,
        getFormConfirmButtonCfg,
        cgTopButtonList,
        importUrl,
        registerModal,
        handleAdd,
        handleEdit,
        handleBatchDelete,

View on GitHub (pinned to 96fb33f5ec)

Solutions

  1. Open the page via the proper menu entry that carries `code`; confirm the URL contains `code=<formCode>`.
  2. For a custom menu, make sure the route path/query includes the online form code (the `onl_cgform_head` code/id).
  3. In dev, append `?code=<yourFormCode>` to the URL.
  4. If the route is intentionally codeless, add a navigation guard that redirects before mount instead of throwing at setup.

Example fix

// before
if (!ID.value) {
  $message.warning('地址错误, 配置ID不存在!');
  throw new Error('地址错误, 配置ID不存在!');
}

// after — redirect to a safe page from a router guard instead of throwing during setup
router.beforeEach((to) => {
  if (to.meta?.isOnlineList && !to.query.code) {
    return { name: 'ExceptionPage', query: { status: '404' } };
  }
  return true;
});
Defensive patterns

Strategy: validation

Validate before calling

// before rendering the list, confirm the route carries the online form code
const code = route.query.code as string | undefined;
if (!code) {
  router.replace({ name: 'ExceptionPage', query: { status: '404', reason: 'missing-code' } });
}

Type guard

const hasFormCode = (c: unknown): c is string => typeof c === 'string' && c.trim().length > 0;

Prevention

When it happens

Trigger: The component's route was opened WITHOUT the required `code` (online form id) param: navigating directly to the list route with no `?code=...`, a stale bookmark, a menu entry whose path/query omits `code`, or a redirect that stripped the query string.

Common situations: Bookmark/favorite to the list page missing `code`; backend menu config lost the code path variable; developer typing the route URL by hand and forgetting `code`; qiankun/sub-app handoff dropped the param.

Related errors


AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14). Data as JSON: /api/errors/9a11da7d381d4c09. Report an issue: GitHub.