Error retrieving Glacier vault inventory via AWS CLI: Unknown options: inventory-retrieval}’

Amazon’s Glacier service is great, but low-cost storage has other costs. For example, you might have a vault but not know what archives it contains. You can retrieve the vault inventory–essentially listing the contents of a directory–but like any Glacier retrieval, it may take several hours.

Using Downloading Vault Inventory using the REST API, I put this together:
C:\>aws glacier initiate-job --account-id - --vault-name my_poorly_named_vault --job-parameters '{"Type": "inventory-retrieval"}'

Which returned:

Unknown options: inventory-retrieval}'

I had taken the command directly from AWS’s example:

(Keep in mind that I had already followed the steps at Installing the Amazon Web Services Command Line Interface and Configuring the Amazon Web Services Command Line Interface.)

According to the documentation for the job-parameters option (,
valid values are “archive-retrieval” and “inventory-retrieval”.

But the error message says inventory-retrieval}’. Why is it picking up the trailing curly brace and the apostrophe?

I formatted the job-parameters JSON in a file named aws-json.txt, with the curly braces on separate lines:

    "Type": "inventory-retrieval"

I tried this variation on the initiate-job command:
C:\>aws glacier initiate-job --account-id - --vault-name my_poorly_named_vault --job-parameters file://aws-json.txt

That worked!

The results returned:

    "jobId": "y8ugyoNzzusaf6Lv72G3hsjAA6O7nw5bJQ2u6J9TDnJ82_qx-lxnqrhSxIcGvOU1iiXoUhZboiojxsDu8gLQOfiJ7hR2",
    "location": "/123456789011/vaults/my_poorly_named_vault/jobs/y8ugyoNzzusaf6Lv72G3hsjAA6O7nw5bJQ2u6J9TDnJ82_qx-lxnqrhSxIcGvOU1iiXoUhZboiojxsDu8gLQOfiJ7hR2"

13 thoughts on “Error retrieving Glacier vault inventory via AWS CLI: Unknown options: inventory-retrieval}’”

  1. Yes, this was driving me crazy also. After some mucking around with the syntax I found the issue. This is a Windows CMD/PowerShell issue as the syntax works fine in Linux. Windows is striping the quotes off. If you don’t want to make a file for this simply use two quotes: --job-parameters '{ ""Type"": ""inventory-retrieval"" }'

  2. Hi chris,
    i’m unable to retrieve files through command prompt API

    C:\Users\10643888>aws glacier initiate-job –account-id 768518232256 –vault-name thiruneeru –job-parameters file:///D:/ss.txt

    Error parsing parameter ‘–job-parameters’: Unable to load paramfile file:///D:/ss.txt: [Errno 22] Invalid argument: ‘/D:/ss.txt’

  3. for some reason I was not able to get this to work from a file:

    'ascii' codec can't encode character u'\xff' in position 26: ordinal not in range(128)

    I took Stan’s option and added a double quote and that worked (using aws.exe from PowerShell):

    $json = '{
    	""Type"": ""inventory-retrieval""
    aws glacier initiate-job --account-id - --vault-name MyVault --job-parameters $json
  4. Well here we are in July 2019 and the AWS KB example still doesn’t work. Thanks for the work around. this is truly a gift that keeps on giving.

  5. This string completely worked from a windows cmd line:
    aws glacier initiate-job –vault-name xxxxxxxxx_0011321AA3E5_3_mapping –account-id 999999999 –job-parameter={\”Type\”:\”inventory-retrieval\”}

    This page was the best help:

    And these info from the page:
    – Optionally, you can optionally separate the parameter name from the value with an equals sign (=) instead of a space. This is typically necessary only if the value of the parameter starts with a hyphen.
    – The Windows command prompt requires double quotation marks (” “) to enclose the JSON data structure. Also, to prevent the command processor from misinterpreting the double quotation marks embedded in the JSON, you must also escape (precede with a backslash [ \ ] character) each double quotation mark (“) within the JSON data structure itself, as in the following example.

    And you may be able to replace the = and no quotes with double-quotes and no escape char (\) as per this line: Only the outermost double quotation marks are not escaped.

Leave a Reply

Your email address will not be published. Required fields are marked *