DIYgod/RSSHub · error · Error

response.msg

Error message

response.msg

What it means

Thrown by requestAPI when the SDO API response code is not 10000 (the success code). The SDO API returns a BaseResponse envelope with code + msg; any non-success code is treated as a failure and the server-supplied msg is re-thrown verbatim as the error message. Because msg comes from the upstream, the thrown message is dynamic.

Source

Thrown at lib/routes/sdo/ff14risingstones/utils.tsx:134

    }
}

export function request(url: string, options?: RequestInit) {
    return ofetch(url, {
        ...options,
        headers: {
            Cookie: `ff14risingstones=${config.sdo.ff14risingstones}`,
            'User-Agent': config.sdo.ua!,
            ...options?.headers,
        },
    });
}

export async function requestAPI<T = any>(url: string, options?: RequestInit) {
    const response = (await request(url, options)) as BaseResponse<T>;

    if (response.code !== 10000) {
        throw new Error(response.msg);
    }
    return response.data;
}

export async function generatePostFeeds(posts: UserPost[]) {
    return await Promise.all(
        posts.map(async (post) => {
            const detail = await getPostsDetail(post.posts_id);
            return {
                title: `[${post.part_name}] ${post.title}`,
                link: `${INDEX_URL}#/post/detail/${post.posts_id}`,
                description: detail?.contentInfo.content,
                pubDate: timezone(parseDate(post.created_at), 8),
                updated: detail?.updated_at ? timezone(parseDate(detail.updated_at), 8) : undefined,
                guid: `sdo/ff14risingstones/posts:${post.posts_id}`,
                author: `${post.character_name}@${post.group_name}`,
            } as DataItem;
        })

View on GitHub (pinned to bed535e087)

Solutions

  1. Refresh the SDO_FF14RISINGSTONES cookie (re-login) and clear any cached auth state.
  2. Match config.sdo.ua to a currently-accepted browser User-Agent.
  3. Log response.code alongside msg to identify the specific failure class (auth vs validation vs rate-limit).
  4. If msg is undefined for a known code, add a code->message map so the error is actionable.

Example fix

// before
if (response.code !== 10000) {
    throw new Error(response.msg);
}

// after — include the code and URL so the failure is identifiable even when msg is empty
if (response.code !== 10000) {
    throw new Error(`ff14risingstones API error (code ${response.code}) at ${url}: ${response.msg ?? 'no message'}`);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Map known non-success codes to actionable messages before the generic throw.
const SDO_ERROR_MAP: Record<number, string> = {
    401: 'Not logged in — refresh SDO_FF14RISINGSTONES cookie',
    429: 'Rate limited by SDO API',
};
if (response.code !== 10000) {
    throw new Error(SDO_ERROR_MAP[response.code] ?? `SDO API error (code ${response.code}): ${response.msg ?? 'no message'}`);
}

Type guard

const isBaseResponse = (r: any): r is { code: number; msg?: string; data?: unknown } =>
    r !== null && typeof r === 'object' && typeof r.code === 'number';

Try / catch

try {
    data = await requestAPI(url, options);
} catch (e) {
    if (e instanceof Error && /not logged in|未登录|登录/.test(e.message)) {
        // cookie likely expired — purge and re-auth, then retry once
        await refreshSdoSession();
        data = await requestAPI(url, options);
    } else if (e instanceof Error && /rate|频繁|429/.test(e.message)) {
        // back off via cache/queue rather than retrying immediately
        throw e;
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: A request to an ff14risingstones API endpoint returns code !== 10000 (e.g. auth failure, expired cookie, rate limit, parameter error). response.msg is then a server-defined string such as '未登录' (not logged in) or a validation message.

Common situations: The ff14risingstones session cookie expired; the UA in config.sdo.ua is blocked; the requested resource id is invalid; SDO deployed a new API contract returning a different success code; response.msg is undefined for some codes, producing a vague 'undefined' error.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/1e605a35ce12e5c4. Report an issue: GitHub.