jvm-http-proxy-agent icon indicating copy to clipboard operation
jvm-http-proxy-agent copied to clipboard

argument REQUEST_ITEM: 'active' is not a valid value

Open maxandersen opened this issue 3 years ago • 1 comments

I run:

eval "$(curl -sS localhost:8001/setup)"
HTTP Toolkit interception enabled

now when running java but not all I get this error:

Picked up JAVA_TOOL_OPTIONS:  -javaagent:"/Applications/HTTP Toolkit.app/Contents/Resources/httptoolkit-server/overrides/java-agent.jar"=127.0.0.1|8000|/Users/max/Library/Preferences/httptoolkit/ca.pem -javaagent:"/Applications/HTTP Toolkit.app/Contents/Resources/httptoolkit-server/overrides/java-agent.jar"=127.0.0.1|8000|/Users/max/Library/Preferences/httptoolkit/ca.pem
usage:
    http [METHOD] URL [REQUEST_ITEM ...]

error:
    argument REQUEST_ITEM: 'active' is not a valid value

for more information:
    run 'http --help' or visit https://httpie.io/docs/cli

I got no references to http so just assuming this is httptoolkit agent causing it ?

maxandersen avatar Aug 23 '22 14:08 maxandersen

It looks like the value in JAVA_TOOL_OPTIONS is doubled up there, which is odd. Did you run the eval command twice, or run it in an already intercepted terminal?

Regardless, though that's weird I wouldn't expect it to cause this... That error appears to be coming from Httpie. HTTP Toolkit certainly doesn't ship with that included, and doesn't call it itself anywhere (or at least, not on purpose).

My best guess - which is a bit of a stretch - is that somehow this println that logs when the agent is set up is being read into something else. I.e. something is reading from stdout and running what it gets as a command. If HTTP runs httpie in your terminal, then this would plausibly run that command, and it would produce almost exactly that error.

E.g. on my machine, running that println as a command in bash:

> http toolkit interception active
usage: http [--json] [--form] [--pretty {all,colors,format,none}] [--style STYLE] [--print WHAT] [--headers] [--body] [--verbose] [--all] [--history-print WHAT] [--stream] [--output FILE]
            [--download] [--continue] [--session SESSION_NAME_OR_PATH | --session-read-only SESSION_NAME_OR_PATH] [--auth USER[:PASS]] [--auth-type {basic,digest}]
            [--proxy PROTOCOL:PROXY_URL] [--follow] [--max-redirects MAX_REDIRECTS] [--timeout SECONDS] [--check-status] [--verify VERIFY] [--ssl {ssl2.3,tls1,tls1.1,tls1.2}] [--cert CERT]
            [--cert-key CERT_KEY] [--ignore-stdin] [--help] [--version] [--traceback] [--default-scheme DEFAULT_SCHEME] [--debug]
            [METHOD] URL [REQUEST_ITEM [REQUEST_ITEM ...]]
http: error: argument REQUEST_ITEM: "active" is not a valid value

No idea why println output would be executed like this though, that's quite unusual.

Does that sound plausible in your setup? We could log to stderr instead, which might be generally a bit safer, but I've never seen this cause issues before.

pimterry avatar Aug 23 '22 15:08 pimterry