Jackett/Jackett · error · Exception

Missing API Key.

Error message

Missing API Key.

What it means

Thrown by MTeamTp.ApplyConfiguration when configData.ApiKey.Value is null, empty, or whitespace. M-Team's API authenticates exclusively via the x-api-key request header (no username/password login), so the indexer refuses to proceed with configuration if that single field is unset. This is a hard validation guard before any network call is made.

Source

Thrown at src/Jackett.Common/Indexers/Definitions/MTeamTp.cs:128

            caps.Categories.AddCategoryMapping(432, TorznabCatType.XXX, "AV(無碼)/Blu-Ray Uncensored");
            caps.Categories.AddCategoryMapping(436, TorznabCatType.XXX, "AV(網站)/0Day");
            caps.Categories.AddCategoryMapping(440, TorznabCatType.XXX, "AV(Gay)/HD");
            caps.Categories.AddCategoryMapping(425, TorznabCatType.XXX, "IV(寫真影集)/Video Collection");
            caps.Categories.AddCategoryMapping(433, TorznabCatType.XXXImageSet, "IV(寫真圖集)/Picture Collection");
            caps.Categories.AddCategoryMapping(411, TorznabCatType.XXX, "H-Game(遊戲)");
            caps.Categories.AddCategoryMapping(412, TorznabCatType.XXX, "H-Anime(動畫)");
            caps.Categories.AddCategoryMapping(413, TorznabCatType.XXX, "H-Comic(漫畫)");

            return caps;
        }

        public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
        {
            LoadValuesFromJson(configJson);

            if (configData.ApiKey.Value.IsNullOrWhiteSpace())
            {
                throw new Exception("Missing API Key.");
            }

            var releases = await PerformQuery(new TorznabQuery());

            await ConfigureIfOK(string.Empty, releases.Any(),
                                () => throw new Exception("Could not find releases."));

            return IndexerConfigurationStatus.Completed;
        }

        public override async Task<byte[]> Download(Uri link)
        {
            var response = await RequestWithCookiesAsync(
                link.ToString(),
                method: RequestType.POST,
                headers: new Dictionary<string, string>
                {
                    { "Accept", "application/json" },

View on GitHub (pinned to adff194147)

Solutions

  1. Open the M-Team indexer configuration in Jackett and paste a valid API key into the ApiKey field.
  2. Generate a fresh API key from the M-Team user settings page (the key must have API access enabled).
  3. Ensure the key has no leading/trailing whitespace — trim it before saving.
  4. Confirm the key works by testing it against the M-Team API with curl before reconfiguring.

Example fix

// before
if (configData.ApiKey.Value.IsNullOrWhiteSpace())
{
    throw new Exception("Missing API Key.");
}

// after — validate with a clearer, actionable message
var key = configData.ApiKey.Value?.Trim();
if (key.IsNullOrWhiteSpace())
{
    throw new ExceptionWithConfigData(
        "API Key is required. Generate one from M-Team → Settings → API.", configData);
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate before calling ApplyConfiguration
var key = configData?.ApiKey?.Value?.Trim();
if (string.IsNullOrEmpty(key))
    return IndexerConfigurationStatus.RequiresTesting; // or surface to UI without throwing

Type guard

bool HasApiKey(IConfigurationData config) =>
    !string.IsNullOrWhiteSpace(config?.ApiKey?.Value);

Prevention

When it happens

Trigger: Calling ApplyConfiguration with a configJson whose ApiKey property is missing, empty, or contains only whitespace. Occurs when a user adds the M-Team indexer but leaves the API Key field blank, or when the JSON payload is malformed/truncated so the ApiKey value doesn't deserialize.

Common situations: User left the API Key textbox empty in the Jackett UI; the API key was copy-pasted with stray whitespace or quotes; the configuration JSON was hand-edited and the key omitted; migrating configs between instances and the key field didn't carry over.

Related errors


AI-assisted analysis of Jackett/Jackett@adff194147 (2026-08-13). Data as JSON: /api/errors/d990060361bc40d6. Report an issue: GitHub.