mas icon indicating copy to clipboard operation
mas copied to clipboard

Map each macOS region without an App Store to a region with an App Store

Open HugeIRL opened this issue 1 month ago • 8 comments

Configuration

Unable to provide, as this is an Updatest user's error. 

However, they are on 4.0.0 which was installed 
with `brew install mas` in the Terminal using Updatest's instructions.

Bug description

Updatest runs mas outdated as part of its discovery flow to detect Mac App Store app updates for users. It does not add anything extra to the command.

Here was the output of mas outdated from Updatest for the user (the same would appear if the user raw ran mas outdated in their terminal except for the top part, that comes from Updatest):

Command: /opt/homebrew/bin/mas outdated
Exit code: 36

Error output:
Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1287445660 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=937984704 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1553936137 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1352778147 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1518425043 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=6448461551 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1470584107 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1055511498 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=6740942938 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1435957248 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1355679052 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=935235287 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1258530160 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1523968394 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=682658836 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1502839586 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=6444667067 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=408981434 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=409183694 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=6446206067 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1532419400 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=985367838 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=905953485 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=409203825 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=409201541 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=6469021132 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1507246666 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1611378436 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=803453959 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1176895641 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=425424353 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=904280696 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=966085870 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1398373917 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=310633997 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Error: Unable to parse response from https://itunes.apple.com/lookup?media=software&entity=desktopSoftware&country=IC&id=1295203466 as JSON:

{
 "errorMessage":"Invalid value(s) for key(s): [country]",
 "queryParameters":{"output":"json", "callback":"A javascript function to handle your search results", "country":"ISO-2A country code", "limit":"The number of search results to return", "term":"A search string", "lang":"ISO-2A language code"}
}

Steps to reproduce

I mean you'd need to set your country to IC first as per the error message above, then run mas outdated in your terminal.

HugeIRL avatar Nov 29 '25 21:11 HugeIRL

"IC" seems to be an "Exceptionally reserved" ISO-3166 Alpha-2 code for the Canary Islands.

I assume they don't have their own App Store. They might use the Spanish App Store.

Can you verify with your user that their macOS location is in the Canary Islands? (System Settings > General > Language & Region > Region)

Can you ask them their App Store country/region? (click on their name in the lower left of the App Store, then click on "Account Settings" near the top right, then read Country/Region from the dialog)

If they use the Spanish App Store, I can make a hardcode to map from "IC" to "ES".

rgoldberg avatar Nov 30 '25 03:11 rgoldberg

Hey @rgoldberg thanks for the info,

It is Canary Islands. The user mentioned it works on one machine where they have it set to Spain, but on a different machine where they have it set to Canary Islands on the machine experiencing the issue.

HugeIRL avatar Nov 30 '25 12:11 HugeIRL

@HugeIRL can you get the user to provide the region of the App Store (not the macOS user), which they can obtain by following the instructions in my prior comment?

If they use the "ES" App Store in the Canary Islands, I'll just map from "IC" to "ES", but I can't do that until I know what normally occurs.

rgoldberg avatar Nov 30 '25 14:11 rgoldberg

I get the same error with region set to the Faroe Islands (FO). App Store is Denmark.

gardamork avatar Dec 02 '25 08:12 gardamork

@gardamork @HugeIRL Thanks for the reports.

Are there any versions of mas that did not suffer from this problem?

I assume this problem exists for mas outdated in all versions of mas other than 3.0.0 & 3.0.1.

I assume the problem doesn't exist for mas outdated --accurate* in mas 3.1.0+, but does exist in 3.1.0+ for outdated with --inaccurate or without any accuracy flags.

Have any versions of mas behaved differently than I outlined above?

I assume mas should just map from certain region codes to other codes, like IC > ES & FO > DK, which should be easy.

I just want to confirm that the problem isn't different than I expected; if you have info that conflicts with my guess, however, I'll need to investigate.

rgoldberg avatar Dec 02 '25 09:12 rgoldberg

Are there any versions of mas that did not suffer from this problem?

I assume this problem exists for mas outdated in all versions of mas other than 3.0.0 & 3.0.1.

I’ve just installed some older versions to test (following this guide), ran mas version to confirm and then mas outdated:

  • 1.8.8 succeeds but outputs nothing even with --verbose
  • 1.9.0 succeeds but outputs nothing even with --verbose
  • 2.0.0 fails
  • 2.3.0 fails
  • 3.0.1 succeeds and shows 3 updates
  • 3.1.0 fails

I assume the problem doesn't exist for mas outdated --accurate* in mas 3.1.0+, but does exist for outdated with --inaccurate or without any accuracy flags.

True for --accurate but not --accurate-ignore-unknown-apps.

Have any versions of mas behaved differently than I outlined above?

Not in my (limited) testing.

gardamork avatar Dec 02 '25 10:12 gardamork

@gardamork Thanks for the info. I forgot that --accurate-ignore-unknown-apps uses the iTunes Search web API (if I thought about it, I would have remembered, I just didn't even think about what the --accurate-* flag was or how it worked…).

I assume that I either added the country query parameter, or only started properly outputting errors in 2.0.0.

Given that all seems as expected (after remembering some stuff), I'll add the 2 mappings, plus any others that I can quickly devise.

I will get to this after I finish some other mas improvements on which I'm currently working. But this will probably be released with them in 4.1.0.

rgoldberg avatar Dec 02 '25 10:12 rgoldberg

This has been postponed until 5.0.0, because I want to remove the region command in favor of config.

I want to output 2 regions in config instead of 1: the macOS region, and the App Store region, which is guessed to be the same as the macOS region, but for various macOS regions that don't have their own App Stores, the region will be mapped to a best guess region with an App Store.

Removing a command & changing the fields output by another command should be done only on a new major version.

In the future, you'll be able to manually configure the App Store to which you connect, but that will depend on a configuration system, which will wait until mas can use Swift Config, which will be only after mas can use Swift 6.2, which will be only after mas needn't build on macOS 14, which will be only after macOS is unsupported by Homebrew, which should be in the fall of 2026.

rgoldberg avatar Dec 06 '25 05:12 rgoldberg