{"record":{"id":"6d848583f2deab7d","repo":"jackwener/OpenCLI","slug":"no-holdings-matched-account-filter-filter","errorCode":null,"errorMessage":"No holdings matched account filter: ${filter}","messagePattern":"No holdings matched account filter: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clis/xueqiu/fund-holdings.js","lineNumber":25,"sourceCode":"    description: '获取蛋卷基金持仓明细（可用 --account 按子账户过滤）',\n    domain: 'danjuanfunds.com',\n    strategy: Strategy.COOKIE,\n    navigateBefore: 'https://danjuanfunds.com/my-money',\n    args: [\n        { name: 'account', type: 'str', default: '', help: '按子账户名称或 ID 过滤' },\n    ],\n    columns: ['accountName', 'fdCode', 'fdName', 'marketValue', 'volume', 'dailyGain', 'holdGain', 'holdGainRate', 'marketPercent'],\n    func: async (page, args) => {\n        const snapshot = await fetchDanjuanAll(page);\n        if (!snapshot.accounts.length) {\n            throw new Error('No fund accounts found — Hint: not logged in to danjuanfunds.com?');\n        }\n        const filter = String(args.account ?? '').trim();\n        const rows = filter\n            ? snapshot.holdings.filter(h => h.accountId === filter || h.accountName.includes(filter))\n            : snapshot.holdings;\n        if (!rows.length) {\n            throw new Error(filter ? `No holdings matched account filter: ${filter}` : 'No holdings found.');\n        }\n        return rows;\n    },\n});\n","sourceCodeStart":7,"sourceCodeEnd":30,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xueqiu/fund-holdings.js#L7-L30","documentation":"This CLI command filters a xueqiu fund-holdings snapshot by an account ID or account name substring supplied via args.account. When no holding rows match the given filter (or the snapshot itself is empty), it throws this Error instead of returning an empty result, to signal that the filter selected nothing. It is a user-input/data mismatch error, not a network failure.","triggerScenarios":"Running the fund-holdings command with --account set to a string that matches no holding's accountId and is not a substring of any holding's accountName (e.g. a typo'd account name, a stale account removed from xueqiu, or a renamed account).","commonSituations":"Typos or trailing whitespace in the account name; xueqiu renamed an account so old scripts no longer match; querying an account that exists on the site but wasn't captured in the snapshot; case-sensitivity since includes() is case-sensitive.","solutions":["Run the command without --account to list all holdings and inspect the actual accountId/accountName values","Copy the exact accountName (including capitalization) or accountId from the unfiltered output","Trim/normalize the filter value (String(args.account).trim()) and check for typos or stale account names","If the snapshot itself is empty, re-fetch/refresh the holdings snapshot from xueqiu first"],"exampleFix":"// before\nnode cli.js fund-holdings --account \"My Fund \"   // trailing space, no match\n// after\nnode cli.js fund-holdings --account \"My Fund\"     // or omit --account to list all","handlingStrategy":"validation","validationCode":"const filter = String(args.account ?? '').trim();\nif (filter && !snapshot.holdings.some(h => h.accountId === filter || h.accountName.includes(filter))) {\n  throw new Error(`Unknown account filter: ${filter}. Available: ` + snapshot.holdings.map(h => h.accountName).join(', '));\n}","typeGuard":null,"tryCatchPattern":"try {\n  const rows = await listFundHoldings({ account: filter });\n} catch (e) {\n  if (e.message.startsWith('No holdings matched account filter')) {\n    const all = await listFundHoldings({});\n    console.error(`Filter '${filter}' not found. Available accounts:`, all.map(h => h.accountName));\n  } else throw e;\n}","preventionTips":["Run without --account first to discover valid accountId/accountName values","Trim and normalize the filter (case, whitespace) before passing it","Store account identifiers from the unfiltered listing rather than retyping them","Re-check account names after any change on the xueqiu side (renames/removals)"],"tags":["cli","filtering","empty-result","user-input"],"backgroundTag":"empty-filter-result","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}