jeecgboot/JeecgBoot · error · Error
地址错误, 配置ID不存在!
Error message
地址错误, 配置ID不存在!
What it means
Second setup guard in the URL-style online Add form (same file as the token guard). After the token check passes, if `ID.value` (online form code) is empty it warns and throws, because the Add form cannot build its columns/buttons without the form code.
Source
Thrown at jeecgboot-vue3/src/views/super/online/cgform/auto/default/OnlineFormUrlAdd.vue:49
import { useOnlineTableContext } from '../../hooks/auto/useOnlineTableContext';
import { useListButton } from '../../hooks/auto/useListButton';
import { useEnhance } from '../../hooks/auto/useEnhance';
import { useRouter } from 'vue-router';
import { useFormUrl } from '../../hooks/auto/useFormUrl';
const { ID, onlineTableContext, onlineExtConfigJson, handleFormConfig } = useOnlineTableContext();
const { createMessage: $message } = useMessage();
const wrapRef = ref(null);
const contentHeight = ref(400);
const loading = ref(true);
const router = useRouter();
const { token } = useFormUrl();
if (!unref(token)) {
throw new Error('token不存在~');
}
if (!ID.value) {
$message.warning('地址错误, 配置ID不存在!');
throw new Error('地址错误, 配置ID不存在!');
}
// 处理增强
let { initCgEnhanceJs } = useEnhance(onlineTableContext);
watch(
() => wrapRef.value,
(elem: HTMLElement) => {
// 获取页面实际高度
contentHeight.value = elem.offsetHeight - 60;
}
);
// 处理列表button
const { registerModal, handleAdd } = useListButton(onlineTableContext, onlineExtConfigJson);
const getContainer = (node) => {
return document.querySelector(`.online-add-${ID.value}`);
};
const success = () => {
setTimeout(() => {
handleAdd(false);View on GitHub (pinned to 96fb33f5ec)
Solutions
- Ensure the Add URL carries both token and code: `?token=<jwt>&code=<formCode>`.
- For a custom menu, include the online form code in the route path/query.
- In dev, append `&code=<yourFormCode>` to the URL.
- Add a router guard that redirects when `code` is missing instead of throwing at setup.
Example fix
// before
if (!ID.value) {
$message.warning('地址错误, 配置ID不存在!');
throw new Error('地址错误, 配置ID不存在!');
}
// after — guard at the route level and redirect with a helpful message
if (!ID.value) {
router.replace({ name: 'ExceptionPage', query: { status: '404', reason: 'missing-code' } });
return;
} Defensive patterns
Strategy: validation
Validate before calling
// confirm the online form code is present (token already validated above)
if (!ID.value) {
router.replace({ name: 'ExceptionPage', query: { status: '404', reason: 'missing-code' } });
return;
} Type guard
const hasFormCode = (c: unknown): c is string => typeof c === 'string' && c.trim().length > 0;
Prevention
- Url-form links must carry both `token` and `code`.
- Validate required route params in a router guard before mount.
- Keep menu/route config in sync with the required params.
- Document the expected URL shape for embedded form consumers.
When it happens
Trigger: Token is present but the route lacks the `code` (form id) param: a deep link with only `?token=...` and no code, a menu misconfiguration, or a redirect that dropped the code param.
Common situations: Stale bookmark that has a token but no code; menu config lost the code path variable; manual URL entry with token but missing code.
Related errors
AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14).
Data as JSON: /api/errors/b78b5381b71de5cc.
Report an issue: GitHub.