Skip to content

bug: Synced Regexes (from URLs) are ignored when querying the /api/v1/search endpoint directly #836

Description

@tomfle18

Deployment Method

Other, specify at description

Addon Version

2026.03.18.2059-nightly (0de87f1)

Bug Area

Obtaining streams.

Device/Browser/OS/Stremio Version

No response

Bug Description / Steps to Reproduce

When querying the /api/v1/search endpoint directly using basic authentication (UUID and password), any Regexes imported via URL (Synced Regexes) are completely ignored by the sorting/filtering engine. However, manually typed (static) regexes work perfectly fine in the exact same API call.
Furthermore, the exact same configuration works flawlessly when accessed via the Stremio endpoint (/:type/:id.json) using the Base64 encoded config.

Public instance: https://aiostreams-nightly.fortheweak.cloud/

To Reproduce
Steps to reproduce the behavior:

Go to the AIOStreams web configuration panel.

Add a valid external URL (e.g., a GitHub raw link) to the Synced Regexes section (e.g., containing a pattern like K83).

Save and sync to DB.

Verify it works in Stremio (the regex is applied, and matching streams are prioritized).

Make a direct API call to the search endpoint using a script or cURL:
GET /api/v1/search?type=movie&id=tt15574124&format=true with Basic Auth.

Look at the JSON response – the streams that should match the synced regex are missing the regexMatched modifier and fall to the bottom of the list.

Workaround test: Add the exact same regex manually as a plain text string in the config panel. Hit the API again – it suddenly works.

Expected Behavior

The /api/v1/search endpoint should evaluate and apply Synced Regexes (via URL) identically to how the Stremio endpoint does, regardless of whether the configuration is passed via Base64 header or loaded from the database via Basic Auth.

Technical Root Cause Analysis (Deep Dive)
After investigating the source code, this appears to be a race condition / initialization issue with the SyncManager during the API request lifecycle.

In packages/core/src/utils/config.ts, the validateRegexes function attempts to load synced regexes by calling RegexAccess.resolveSyncedRegexesForValidation(config).

This relies on the SyncManager (packages/core/src/utils/sync.ts), which requires its .initialise() method to fetch or refresh data from external URLs.

During a direct /api/v1/search request with Basic Auth, the config is validated on the fly. It seems the SyncManager is either not fully initialized or fails to fetch the cache in this specific execution context.

When resolveSyncedRegexesForValidation(config) throws an error or returns empty, the catch block in validateRegexes silently swallows the issue and executes a fallback:

} catch (error) {
    // Falls back ONLY to statically typed patterns, ignoring synced ones entirely
    excludedRegexes = config.excludedRegexPatterns || [];
    // ...
}

This silently strips all Synced Regexes from the API query context.

Environment:

Endpoint: /api/v1/search

Auth Method: Basic Auth (UUID:Password)

Affected Feature: Synced Regexes & Synced Stream Expressions (likely affected by the same SyncManager logic).

Configuration Export

{
"trusted": false,
"addonName": "AIO|PL",
"appliedTemplates": [
{
"id": "builtin.debrid-starter",
"version": "1.0.1"
},
{
"id": "aiostreams|pl-2026-03-18.18-15-11-mc073nn",
"version": "2.0.0"
}
],
"excludedResolutions": [
"240p",
"360p",
"144p"
],
"includedResolutions": [],
"requiredResolutions": [],
"preferredResolutions": [
"2160p",
"1440p",
"1080p",
"720p",
"576p",
"480p",
"360p",
"240p",
"144p",
"Unknown"
],
"excludedQualities": [
"CAM",
"SCR",
"TS",
"TC"
],
"includedQualities": [],
"requiredQualities": [],
"preferredQualities": [
"BluRay REMUX",
"BluRay",
"WEB-DL",
"WEBRip",
"HDRip",
"HC HD-Rip",
"DVDRip",
"HDTV",
"CAM",
"TS",
"TC",
"SCR",
"Unknown"
],
"excludedLanguages": [],
"includedLanguages": [],
"requiredLanguages": [],
"preferredLanguages": [
"Polish"
],
"excludedVisualTags": [
"3D",
"H-OU",
"H-SBS"
],
"includedVisualTags": [],
"requiredVisualTags": [],
"preferredVisualTags": [],
"excludedAudioTags": [],
"includedAudioTags": [],
"requiredAudioTags": [],
"preferredAudioTags": [],
"excludedAudioChannels": [],
"includedAudioChannels": [],
"requiredAudioChannels": [],
"preferredAudioChannels": [],
"excludedStreamTypes": [],
"includedStreamTypes": [],
"requiredStreamTypes": [],
"preferredStreamTypes": [],
"excludedEncodes": [],
"includedEncodes": [],
"requiredEncodes": [],
"preferredEncodes": [],
"preferredRegexPatterns": [],
"syncedPreferredRegexUrls": [
"https://raw.githubusercontent.com/tomfle18/regex-pol/refs/heads/main/regex_pol_v1.json"
],
"syncedIncludedRegexUrls": [],
"syncedRequiredRegexUrls": [],
"syncedRankedRegexUrls": [],
"excludedKeywords": [
"trailer",
"screener",
"telesynch"
],
"seederRangeTypes": [],
"ageRangeTypes": [
"usenet"
],
"digitalReleaseFilter": {
"enabled": false,
"tolerance": 0,
"requestTypes": [],
"addons": []
},
"enableSeadex": true,
"excludeCachedFromAddons": [],
"excludeCachedFromServices": [],
"excludeCachedFromStreamTypes": [],
"excludeUncachedFromAddons": [],
"excludeUncachedFromServices": [],
"excludeUncachedFromStreamTypes": [],
"excludedStreamExpressions": [],
"preferredStreamExpressions": [
{
"expression": "merge(regexMatched(streams),language(streams, 'Polish'),subtitle(streams, 'Polish'),library(streams))",
"enabled": true
}
],
"regexOverrides": [],
"dynamicAddonFetching": {
"enabled": false
},
"groups": {
"enabled": false
},
"sortCriteria": {
"global": [
{
"key": "streamExpressionMatched",
"direction": "desc"
},
{
"key": "cached",
"direction": "desc"
},
{
"key": "resolution",
"direction": "desc"
},
{
"key": "size",
"direction": "desc"
}
],
"movies": [],
"series": [],
"anime": [],
"cached": [],
"uncached": [],
"cachedMovies": [],
"uncachedMovies": [],
"cachedSeries": [],
"uncachedSeries": [],
"cachedAnime": [],
"uncachedAnime": []
},
"posterService": "none",
"formatter": {
"id": "custom",
"definition": {
"name": "{stream.regexMatched::exists::or::stream.languages::~Polish::or::stream.subtitles::~Polish["🇵🇱 "||""]}{stream.library::istrue["☁️"||""]}{service.shortName::exists["[{service.shortName}"||""]}{service.cached::istrue["⚡️]"||""]}{service.cached::isfalse["⬇️]"||""]} {addon.name} {stream.resolution::exists["{stream.resolution::replace('2160p', '4K')}"||""]}",
"description": "{stream.filename::exists["{stream.filename}"||""]}\n{stream.quality::~REMUX["📀Remux"||""]}{stream.quality::=BluRay["💿BluRay"||""]}{stream.quality::~DL["🖥️Web-DL"||""]}{stream.quality::=WEBRIP["🖥️WEBRIP"||""]}{stream.quality::=HDRip["💻HDRip"||""]}{stream.quality::~HC["💻HC"||""]}{stream.quality::=DVDRip["💽DVDRip"||""]}{stream.quality::=HDTV["📺HDTV"||""]}{stream.indexer::exists["🔍 {stream.indexer}"||""]}\n{stream.encode::exists::or::stream.visualTags::exists["🎞️ "||""]}{stream.encode::exists["{stream.encode}"||""]}{stream.encode::exists::and::stream.visualTags::exists[" | "||""]}{stream.visualTags::exists["{stream.visualTags::join(' | ')}"||""]}\n{stream.audioTags::exists::or::stream.audioChannels::exists["🎧 "||""]}{stream.audioTags::exists["{stream.audioTags::join(' | ')}"||""]}{stream.audioTags::exists::and::stream.audioChannels::exists[" | "||""]}{stream.audioChannels::exists["{stream.audioChannels::join(' | ')}"||""]}\n{stream.size::>0["📦 {stream.size::bytes} "||""]}{stream.folderSize::>0["/ 📦 {stream.folderSize::bytes}"||""]}{service.cached::isfalse::and::stream.seeders::>0["🌱 {stream.seeders} "||""]}{stream.age::exists["📅 {stream.age} "||""]}\n{stream.languages::exists["🗣️ {stream.languageEmojis::join(' | ')}"||""]}{stream.subtitles::exists["✏️ {stream.subtitleEmojis::join(' | ')}"||""]}\n{stream.message::exists["ℹ️ {stream.message}"||""]}"
}
},
"proxy": {
"id": "mediaflow",
"proxiedAddons": [],
"proxiedServices": []
},
"hideErrors": false,
"hideErrorsForResources": [
"subtitles",
"catalog",
"meta",
"addon_catalog"
],
"statistics": {
"enabled": true,
"statsToShow": [
"addon",
"filter",
"timing"
]
},
"yearMatching": {
"enabled": true,
"strict": false,
"useInitialAirDate": false,
"requestTypes": [],
"addons": []
},
"titleMatching": {
"mode": "exact",
"similarityThreshold": 0.9,
"enabled": true,
"requestTypes": [],
"addons": [
"534",
"137",
"3cf",
"60b",
"de1"
]
},
"seasonEpisodeMatching": {
"enabled": false,
"requestTypes": [
"series",
"anime",
"tv",
"channel"
],
"addons": []
},
"deduplicator": {
"enabled": true,
"excludeAddons": [],
"multiGroupBehaviour": "aggressive",
"keys": [
"infoHash"
],
"cached": "per_service",
"uncached": "per_service",
"p2p": "per_service",
"libraryBehaviour": "prefer"
},
"autoPlay": {
"enabled": false,
"attributes": [
"service",
"proxied",
"resolution",
"quality",
"encode",
"audioTags",
"visualTags",
"languages",
"releaseGroup"
]
},
"precacheSelector": "count(cached(streams)) == 0 ? uncached(streams) : []",
"services": [
{
"id": "torbox",
"enabled": true,
"credentials": {}
},
{
"id": "realdebrid",
"enabled": true,
"credentials": {}
}
],
"presets": [
{
"type": "torbox-search",
"instanceId": "c83",
"enabled": true,
"options": {
"name": "TB Search",
"timeout": 15000,
"sources": [
"torrent"
],
"mediaTypes": [],
"userSearchEngines": false,
"onlyShowUserSearchResults": false,
"useMultipleInstances": true
}
},
{
"type": "torrentio",
"instanceId": "80c",
"enabled": true,
"options": {
"name": "BestTorrents",
"timeout": 15000,
"resources": [
"stream"
],
"providers": [
"besttorrents"
],
"useMultipleInstances": true,
"mediaTypes": []
}
},
{
"type": "torrentio",
"instanceId": "83d",
"enabled": true,
"options": {
"name": "Torrentio",
"timeout": 15000,
"resources": [
"stream"
],
"providers": [
"wolfmax4k",
"mejortorrent",
"ilcorsaronero",
"torrent9",
"bludv",
"comando",
"rutracker",
"rutor",
"anidex",
"tokyotosho",
"nyaasi",
"horriblesubs",
"magnetdl",
"torrentgalaxy",
"kickasstorrents",
"thepiratebay",
"1337x",
"rarbg",
"eztv",
"yts",
"cinecalidad"
],
"mediaTypes": [],
"useMultipleInstances": true
}
},
{
"type": "meteor",
"instanceId": "994",
"enabled": true,
"options": {
"name": "Meteor",
"timeout": 15000,
"resources": [
"stream"
],
"includeP2P": false,
"removeTrash": true,
"useMultipleInstances": true,
"mediaTypes": []
}
},
{
"type": "stremthruStore",
"instanceId": "681",
"enabled": true,
"options": {
"name": "ST Store",
"timeout": 15000,
"resources": [
"catalog",
"meta",
"stream"
],
"mediaTypes": [],
"hideStreams": false,
"webDl": true,
"usenet": false
}
},
{
"type": "library",
"instanceId": "f64",
"enabled": true,
"options": {
"name": "Library",
"timeout": 15000,
"resources": [
"stream"
],
"mediaTypes": [],
"sources": [
"torrent"
],
"showRefreshActions": [
"stream"
],
"skipProcessing": false,
"hideStreams": false,
"useMultipleInstances": true
}
},
{
"type": "comet",
"instanceId": "c9f",
"enabled": true,
"options": {
"name": "Comet|Goldy",
"timeout": 15000,
"resources": [
"stream"
],
"includeP2P": false,
"removeTrash": true,
"mediaTypes": [],
"url": "https://comet.feels.legal/"
}
},
{
"type": "comet",
"instanceId": "7df",
"enabled": true,
"options": {
"name": "Comet|Kuu",
"timeout": 15000,
"resources": [
"stream"
],
"url": "https://comet.stremio.ru",
"includeP2P": false,
"removeTrash": true,
"scrapeDebridAccountTorrents": false,
"useMultipleInstances": false,
"mediaTypes": []
}
},
{
"type": "comet",
"instanceId": "e3d",
"enabled": true,
"options": {
"name": "Comet|Midnight",
"timeout": 15000,
"resources": [
"stream"
],
"includeP2P": false,
"removeTrash": true,
"scrapeDebridAccountTorrents": false,
"useMultipleInstances": false,
"mediaTypes": []
}
},
{
"type": "mediafusion",
"instanceId": "eec",
"enabled": true,
"options": {
"name": "MF|Midnight",
"timeout": 15000,
"resources": [
"stream"
],
"useCachedResultsOnly": true,
"enableWatchlistCatalogs": false,
"downloadViaBrowser": false,
"contributorStreams": false,
"certificationLevelsFilter": [],
"nudityFilter": [],
"mediaTypes": [],
"url": "https://mediafusionfortheweebs.midnightignite.me"
}
},
{
"type": "stremthruTorz",
"instanceId": "29d",
"enabled": true,
"options": {
"name": "ST Torz|Yeb",
"timeout": 15000,
"resources": [
"stream"
],
"mediaTypes": [],
"includeP2P": false,
"useMultipleInstances": true
}
},
{
"type": "stremthruTorz",
"instanceId": "09c",
"enabled": true,
"options": {
"name": "ST Torz|Munif",
"timeout": 15000,
"resources": [
"stream"
],
"url": "https://stremthru.13377001.xyz/stremio/torz/",
"mediaTypes": [],
"includeP2P": false,
"useMultipleInstances": true
}
},
{
"type": "stremthruTorz",
"instanceId": "0be",
"enabled": true,
"options": {
"name": "ST Torz|ATBP",
"timeout": 15000,
"resources": [
"stream"
],
"url": "https://stremthru.atbphosting.com/stremio/torz/",
"mediaTypes": [],
"includeP2P": false,
"useMultipleInstances": true
}
},
{
"type": "stremthruTorz",
"instanceId": "73f",
"enabled": true,
"options": {
"name": "ST Torz|Midnight",
"timeout": 15000,
"resources": [
"stream"
],
"url": "https://stremthrufortheweebs.midnightignite.me/stremio/torz/",
"mediaTypes": [],
"includeP2P": false,
"useMultipleInstances": true
}
},
{
"type": "stremthruTorz",
"instanceId": "79a",
"enabled": true,
"options": {
"name": "ST Torz|Kuu",
"timeout": 15000,
"resources": [
"stream"
],
"url": "https://stremthru.stremio.ru/stremio/torz/",
"mediaTypes": [],
"includeP2P": false,
"useMultipleInstances": true
}
},
{
"type": "zilean",
"instanceId": "a32",
"enabled": true,
"options": {
"name": "Zilean",
"timeout": 15000,
"mediaTypes": [],
"useMultipleInstances": true
}
},
{
"type": "sootio",
"instanceId": "78e",
"enabled": true,
"options": {
"name": "Sootio",
"timeout": 15000,
"resources": [
"stream"
],
"httpProviders": [],
"mediaTypes": [],
"useMultipleInstances": true
}
},
{
"type": "bitmagnet",
"instanceId": "cc6",
"enabled": true,
"options": {
"name": "Bitmagnet",
"timeout": 15000,
"mediaTypes": [],
"useMultipleInstances": true,
"paginate": true
}
},
{
"type": "peerflix",
"instanceId": "5b3",
"enabled": true,
"options": {
"name": "Peerflix",
"timeout": 15000,
"resources": [
"stream"
],
"mediaTypes": [],
"useMultipleInstances": true,
"showTorrentLinks": false
}
},
{
"type": "torrents-db",
"instanceId": "549",
"enabled": true,
"options": {
"name": "TorrentsDB",
"timeout": 15000,
"resources": [
"stream"
],
"mediaTypes": [],
"providers": [
"yts",
"1337x",
"torrentcsv",
"1lou",
"nyaa",
"sktorrent",
"1tamilblasters",
"limetorrent",
"1tamilmv",
"rargb",
"knaben",
"thepiratebay",
"kickasstorrents",
"animetosho",
"extremlymtorrents",
"yggtorrent",
"tokyotosho",
"rutor",
"rutracker",
"torrent9",
"ilcorsaronero",
"manual"
],
"includeP2P": false,
"useMultipleInstances": true
}
},
{
"type": "knaben",
"instanceId": "534",
"enabled": true,
"options": {
"name": "Knaben",
"timeout": 15000,
"mediaTypes": [],
"useMultipleInstances": false
}
},
{
"type": "animetosho",
"instanceId": "137",
"enabled": true,
"options": {
"name": "AnimeTosho",
"timeout": 15000,
"mediaTypes": [
"anime"
],
"useMultipleInstances": false
}
},
{
"type": "seadex",
"instanceId": "60b",
"enabled": true,
"options": {
"name": "SeaDex",
"timeout": 15000,
"mediaTypes": [
"anime"
]
}
},
{
"type": "debridio",
"instanceId": "b31",
"enabled": true,
"options": {
"name": "Debridio",
"timeout": 15000,
"resources": [
"stream"
],
"url": "",
"mediaTypes": []
}
},
{
"type": "comet",
"instanceId": "684",
"enabled": false,
"options": {
"name": "Comet|EH",
"timeout": 15000,
"resources": [
"stream"
],
"url": "https://comet.elfhosted.com",
"includeP2P": false,
"removeTrash": true,
"scrapeDebridAccountTorrents": false,
"useMultipleInstances": false,
"mediaTypes": []
}
},
{
"type": "stremthruTorz",
"instanceId": "67c",
"enabled": false,
"options": {
"name": "ST Torz|EH",
"timeout": 15000,
"resources": [
"stream"
],
"url": "https://stremthru.elfhosted.com/stremio/torz/",
"mediaTypes": [],
"includeP2P": false,
"useMultipleInstances": true
}
},
{
"type": "mediafusion",
"instanceId": "d6e",
"enabled": false,
"options": {
"name": "MF|EH",
"timeout": 15000,
"resources": [
"stream"
],
"url": "https://mediafusion.elfhosted.com",
"useCachedResultsOnly": true,
"enableWatchlistCatalogs": false,
"downloadViaBrowser": false,
"contributorStreams": false,
"certificationLevelsFilter": [],
"nudityFilter": [],
"mediaTypes": []
}
},
{
"type": "mediafusion",
"instanceId": "0b2",
"enabled": false,
"options": {
"name": "MediaFusion|Kuu",
"timeout": 15000,
"resources": [
"stream"
],
"url": "https://mediafusion.stremio.ru",
"useCachedResultsOnly": true,
"enableWatchlistCatalogs": false,
"downloadViaBrowser": false,
"contributorStreams": false,
"certificationLevelsFilter": [],
"nudityFilter": [],
"mediaTypes": []
}
},
{
"type": "eztv",
"instanceId": "3cf",
"enabled": false,
"options": {
"name": "EZTV",
"timeout": 15000,
"mediaTypes": [
"series"
]
}
},
{
"type": "neko-bt",
"instanceId": "de1",
"enabled": false,
"options": {
"name": "nekoBT",
"timeout": 15000,
"mediaTypes": [],
"useMultipleInstances": true
}
},
{
"type": "torbox",
"instanceId": "7d1",
"enabled": false,
"options": {
"name": "TorBox",
"timeout": 15000,
"resources": [
"stream",
"catalog",
"meta"
],
"mediaTypes": []
}
}
],
"catalogModifications": [
{
"id": "6814414.st:store:rd",
"type": "other",
"name": "Store RD",
"shuffle": false,
"enabled": true,
"usePosterService": false,
"hideable": true,
"searchable": true,
"addonName": "ST Store"
},
{
"id": "681791b.st:store:tb",
"type": "other",
"name": "Store TB",
"shuffle": false,
"enabled": true,
"usePosterService": false,
"hideable": true,
"searchable": true,
"addonName": "ST Store"
},
{
"id": "681791b.st:store:tb-webdl",
"type": "other",
"name": "Store TB-WEBDL",
"shuffle": false,
"enabled": true,
"usePosterService": false,
"hideable": true,
"searchable": true,
"addonName": "ST Store"
}
],
"cacheAndPlay": {
"enabled": true,
"streamTypes": [
"usenet"
]
},
"checkOwned": true
}

Screenshots

No response

Debugging Checklist

  • If applicable, I have included server logs
  • If applicable, I have included MediaFlow logs

Issue Checklist

  • I have written a short but informative title that clearly describes the issue.
  • I have given clear and descriptive steps to reproduce the issue.
  • I have checked open and closed issues and confirmed that this is not a duplicate of another issue.
  • I have filled out all of the requested information adequately.
  • I am using the latest version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions