AWS CLI - All commands return Unknown output type: [None]
Asked Answered
C

7

37

All of my aws-cli commands returned

Unknown output type: [None]

I checked my configuration

$ aws configure

appeared normal but i was unable to edit my 'Default output format'

I ran my aws-cli command with --debug and saw

MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 208, in main
    return command_table[parsed_args.command](remaining, parsed_args)
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 345, in __call__
    return command_table[parsed_args.operation](remaining, parsed_globals)
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 517, in __call__
    call_parameters, parsed_globals)
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 638, in invoke
    self._display_response(operation_name, response, parsed_globals)
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 657, in _display_response
    formatter = get_formatter(output, parsed_globals)
  File "/Library/Python/2.7/site-packages/awscli/formatter.py", line 272, in get_formatter
    raise ValueError("Unknown output type: %s" % format_type)
ValueError: Unknown output type: [None]
Crossing answered 7/2, 2018 at 1:23 Comment(1)
Output type can be one of json, text or table (all in lower case)Decameter
C
14

My ~/.aws/config was somehow in a bad state, there were multiple declarations for the same setting under a single role header. Editing the file manually fixed my issue.

The info under Configuration Settings and Precedence https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html led me to the right place.

Crossing answered 7/2, 2018 at 1:23 Comment(1)
Creating new ~/.aws/config file with aws configure worked for mePrecis
D
58
$aws configure
press Enters
see the "Default output format [None]:" 
input one of "json, text or table "(all in lower case) 
after that rerun your command. 
Demetrademetre answered 19/1, 2019 at 2:49 Comment(1)
I had a user type .json that caused a similar error: Unknown output type: .jsonDendroid
Q
29

Run the command "aws configure", then check if the word "JSON" in "Default output format [JSON]:" is in upper case or lower case? If it's in upper case then running any aws command shows "Unknown ouput type : JSON".
Or alternately open the file C:\Users\<user>\.aws\config file and check the entry "output = json". If the word json is in upper case then running any aws command shows "Unknown ouput type : JSON".

Solution:
Replace the upper case JSON with lower case json.

Quickie answered 15/5, 2021 at 7:19 Comment(1)
Excellent answer. Changing JSON to json was the solution for me: sed 's/JSON/json/g' -i ~/.aws/configAbdu
C
14

My ~/.aws/config was somehow in a bad state, there were multiple declarations for the same setting under a single role header. Editing the file manually fixed my issue.

The info under Configuration Settings and Precedence https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html led me to the right place.

Crossing answered 7/2, 2018 at 1:23 Comment(1)
Creating new ~/.aws/config file with aws configure worked for mePrecis
C
0

Figure out your ARN and your role and set up everything (region and clustername) as in the below command in the respective place.

aws eks update-kubeconfig --name eks-cluster-name --region aws-region --role-arn arn:aws:iam::XXXXXXXXXXXX:role/testrole

Also, read on the documentation here below.

https://aws.amazon.com/premiumsupport/knowledge-center/eks-api-server-unauthorized-error/

Civvies answered 8/9, 2022 at 12:2 Comment(0)
U
0

using AWS Cloud Shell it was giving me the same error when I used us-east-1 and after changing the region to us-east-2 the problem is solved. when I try it on my desktop by changing the region to us-east-2 with JSON option still the error happens. try changing regions with Cloud Shell availability.

Unbelief answered 14/7, 2023 at 5:40 Comment(0)
R
0

Go to .aws folder and cat the config and credentials files just comment out the line containing output = NONE. enter image description here

Repro answered 17/8, 2023 at 21:14 Comment(0)
A
0

Apparently, the .aws/config must say lower case json, not uppercase JSON, i.e.

[default]
region = eu-west-2
output = json

This definitely works.

Aulea answered 16/4 at 11:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.