The replica returned Http Error - status 500 Internal Server Error

Note: this entry has been edited like 10 times because the message board software hates double dashes or parens or something that makes it really hard to paste in terminal output.:joy:
I’m trying to deploy the ledger for use with my local dfx. I’ve pulled a few things together and think I’m doing things correctly, but am hitting a wall.

dfx version: 0.7.1
os: macOS 11.3

dfx.json
{
  "canisters": {
    "ledger": {
      "build": "cargo build --target wasm32-unknown-unknown --package ledger-canister --release",
      "candid": "./candid/ledger.did",
      "wasm": "../rs/target/wasm32-unknown-unknown/release/ledger-canister.wasm",
      "type": "custom"
    }
  },
  "defaults": {
    "build": {
      "packtool": ""
    }
  },
  "dfx": "0.7.1",
  "networks": {
    "local": {
      "bind": "127.0.0.1:8000",
      "type": "ephemeral"
    }
  },
  "version": 1
}

canister_ids.json - I manually added this and put rrkah-fqaaa-aaaaa-aaaaq-cai as the ledger principal because I wanted it to match production ID/Principals.

{
  "__Candid_UI": {
    "local": "ryjl3-tyaaa-aaaaa-aaaba-cai"
  },
  "ledger": {
    "local": "rrkah-fqaaa-aaaaa-aaaaq-cai"
  }
}

Deploy Command - minting_account is the Account ID for index 0 of the cycles_minting_canister on ic0…maybe this isn’t what this is supposed to be but I don’t think it matters for deployment. The other vec is the account ID from my dfx ledger account-id

dfx deploy ledger --argument 'record {minting_account="b07xxxxxxx93"; initial_values=vec {record{"e2xxxxxxxxx87e";record{e8s=1000000000;}}}; max_message_size_bytes=null;transaction_window=null;archive_options=null;send_whitelist=vec{};}'

The output I receive is below:

Deploying ledger
All canisters have already been created.
Building canisters...
Executing cargo build ...
removed warnings because they wont let me post output
    Finished release in 1.08s

Installing canisters...
Installing code for canister ledger, with canister_id rrkah-fqaaa-aaaaa-aaaaq-cai
The replica returned an HTTP Error: Http Error: status 500 Internal Server Error, content type "text/plain; charset=utf-8", content: Broken pipe (os error 32)

Previously I’ve also received:

The replica returned an HTTP Error: Http Error: status 500 Internal Server Error, content type "text/plain; charset=utf-8", content: Protocol wrong type for socket os error 41

Any thoughts on what I’m doing wrong here? I’ve basically set dfx up in the rs directory of github.com/dfinity/ic. Maybe there is something in this config that messes with something? It seemed like a good start to do what I’m trying to do.

In case it is important, here is the output from dfx start:

dfx start --clean
Jun 07 20:38:37.163 INFO ic-starter. Configuration: ValidatedConfig replica_path - Some "/mydir/.cache/dfinity/versions/0.7.1/replica", replica_version: "0.1.0", log_level: Warning, cargo_bin: "cargo", cargo_opts: "", state_dir:
"/mydir//mypath/development/ic/rs/.dfx/state/replicated_state", http_listen_addr: V4 127.0.0.1:0, http_port_file: Some "/mydir//mypath/development/ic/rs/.dfx/replica-configuration/replica-1.port", metrics_addr: None, provisional_whitelist: SomeAll, artifact_pool_dir: "/mydir//mypath/development/ic/rs/.dfx/state/replicated_state/node-100/ic_consensus_pool", artifact_backup_dir: None, crypto_root: "/mydir//mypath/development/ic/rs/.dfx/state/replicated_state/node-100/crypto", state_manager_root: "/mydir//mypath/development/ic/rs/.dfx/state/replicated_state/node-100/state", registry_local_store_path: "/mydir//mypath/development/ic/rs/.dfx/state/replicated_state/ic_registry_local_store", unit_delay: None, initial_notary_delay: None, detect_consensus_starvation: None, consensus_pool_backend: Some "rocksdb", state_dir_holder: None , Application: starter
Jun 07 20:38:37.163 INFO Initialize replica configuration "/mydir//mypath/development/ic/rs/.dfx/state/replicated_state/ic.json5", Application: starter
Jun 07 20:38:37.957 INFO Executing /mydir/.cache/dfinity/versions/0.7.1/replica --replica-version  0.1.0 config-file"/mydir//mypath/development/ic/rs/.dfx/state/replicated_state/ic.json5, Application: starter
Starting webserver for replica at http://localhost:60685
binding to: V4 127.0.0.1:8000
replicas: http://localhost:60685/

I’ll add that a motoko canister is installing just fine. Perhaps this is internal and one of the system canisters needs to exist first? I’m going to poke around in the code.

The replica returned an HTTP Error: Http Error: status 500 Internal Server Error, content type "text/plain; charset=utf-8", content: Broken pipe (os error 32)

This error occurs because the Wasm module you’re trying to install is too large. Previously the http handler would return a better error message from the replica (one about ingress message size exceeding the limit.)
It’s not present in dfinity/ic but the ledger and other nns canisters are optimized. You can find a similar optimization script in the cycles wallet here: cycles-wallet/build.sh at main · dfinity/cycles-wallet · GitHub

The replica returned an HTTP Error: Http Error: status 500 Internal Server Error, content type "text/plain; charset=utf-8", content: Protocol wrong type for socket os error 41

I’m not sure about this one however; how consistently do you see this?