DIYgod/RSSHub · error · InvalidParameterError

Invalid username

Error message

Invalid username

What it means

The Gumroad route builds `https://${username}.gumroad.com/l/${products}` and validates `username` with isValidHost before requesting. If the username is not a valid hostname label (alphanumeric + hyphens), it throws InvalidParameterError. This protects against malformed subdomains and URL injection.

Source

Thrown at lib/routes/gumroad/index.tsx:45

};

const renderDescription = (img, productsName, price, desc, stack) =>
    renderToString(
        <>
            <img src={img} />
            <h1>{productsName}</h1>
            <p style="color: red;">{price}</p>
            {desc ? <>{raw(desc)}</> : null}
            <hr />
            {stack ? <>{raw(stack)}</> : null}
        </>
    );

async function handler(ctx) {
    const username = ctx.req.param('username');
    const products = ctx.req.param('products');
    if (!isValidHost(username)) {
        throw new InvalidParameterError('Invalid username');
    }
    const url = `https://${username}.gumroad.com/l/${products}`;

    const response = await got(url);
    const $ = load(response.data);
    const title = $('section.product-content.product-content__row > header > h1').text();
    const userFullName = $('section.product-content.product-content__row > section.details > a').text();

    const item = [
        {
            title,
            link: url,
            description: renderDescription(
                response.data.match(/data-preview-url="(.*?)"/)[1],
                title,
                $('div.price').text(),
                $('section.product-content.product-content__row > section:nth-child(3) > div').html(),
                $('div.product-info').find('ul.stack').html()

View on GitHub (pinned to bed535e087)

Solutions

  1. Pass the bare Gumroad subdomain username (lowercase letters, digits, hyphens only).
  2. Do not include the protocol or `gumroad.com` — the handler adds them.
  3. Confirm the username by opening `<username>.gumroad.com` in a browser first.

Example fix

// before
//   /gumroad/my.shop.name/myproduct
// after
//   /gumroad/myshopname/myproduct
Defensive patterns

Strategy: validation

Validate before calling

import isValidHost from '@/utils/valid-host';
function isValidGumroadUser(username: string): boolean {
  return /^[a-z0-9-]+$/.test(username) && isValidHost(username);
}

Type guard

function isValidGumroadUser(username: string): username is string {
  return /^[a-z0-9-]+$/.test(username) && isValidHost(username);
}

Prevention

When it happens

Trigger: `/gumroad/<username>/<products>` where <username> contains invalid hostname characters (dots, slashes, spaces, punctuation) or is empty.

Common situations: Passing a full URL or email instead of the bare username; including `gumroad.com` in the username; typos that introduce punctuation.

Related errors


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