siyuan-note/siyuan · error

invalid type

Error message

invalid type

What it means

Thrown during profile import when data.type is neither "siyuan-entry-profile" nor "siyuan-entry-profile-bundle" (or a bundle lacks data.profiles): the file parsed and its version is supported, but it is not an entry-visibility profile export at all — likely an unrelated JSON file.

Solutions

  1. Verify the file was exported via the entry-visibility profile import/export UI
  2. Check the file's type field matches "siyuan-entry-profile" or "siyuan-entry-profile-bundle"
  3. Re-export the profile from the correct settings panel
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at app/src/config/entryVisibility/ui.ts:910 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/751ef7f4a2f604bd. Report an issue: GitHub.

Appendix: source

Thrown at app/src/config/entryVisibility/ui.ts:910

    }
};

const importProfiles = async (root: HTMLElement, file: File) => {
    if (!getHostCapabilities().importExport) {
        return;
    }
    try {
        const data = JSON.parse(await file.text()) as TImportFile;
        if (!isEntryVisibilityImportVersionSupported(data.version, ENTRY_VISIBILITY_VERSION)) {
            throw new Error("unsupported version");
        }
        let imported: TEntryVisibilityImportProfile[];
        if (data.type === "siyuan-entry-profile" && data.profile) {
            imported = [data.profile];
        } else if (data.type === "siyuan-entry-profile-bundle" && Array.isArray(data.profiles)) {
            imported = data.profiles;
        } else {
            throw new Error("invalid type");
        }
        const config = cloneConfig();
        let importedCount = 0;
        imported.forEach((item) => {
            const profile = normalizeEntryVisibilityImportProfile(item, data.version, createEntryOrderSnapshot());
            if (!profile) {
                return;
            }
            config.profiles.push({
                id: genUUID(),
                name: uniqueName(profile.name, config.profiles),
                entries: profile.entries,
                orders: profile.orders,
            });
            importedCount++;
        });
        if (imported.length > 0 && importedCount === 0) {
            throw new Error("invalid profiles");

View on GitHub (pinned to 9f775e8a12)