title: How to debug chaincode? LedgerError - ResourceNotFound
body: <p>I got this I believe pretty common error <code>"..LedgerError - ResourceNotFound: ledger: resource not found" .</code></p>
  
  <p>To make it simple, this is what I have:</p>
  
  <ol>
  <li><p>Try simple chaincode, the given <code>chaincode_example02.go</code> codes</p></li>
  <li><p>turned off security hence no CA <code>(CORE_SECURITY_ENABLED=false CORE_SECURITY_PRIVACY=falss)</code></p></li>
  <li><p>1 peer node only (using 0.5 version), it is a peer docker image</p></li>
  <li><p>run in dev mode</p></li>
  </ol>
  
  <p>This is how I deployed the code in dev mode, pls do verify if the cli is correct: </p>
  
  <pre><code>CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:30303 ./chaincode_example02 
  </code></pre>
  
  <p>and it shows </p>
  
  <pre><code>'Received REGISTERED, ready for invocations'
  </code></pre>
  
  <p>Now trying to query it, pls do verify if this cli is correct :</p>
  
  <pre><code>peer chaincode query -n mycc -c '{"Function": "query", "Args": ["b"]}'
  </code></pre>
  
  <p>but the error returned were :</p>
  
  <pre><code>Error: Error querying chaincode: rpc error: code = 2 desc = "Error:Failed to launch chaincode spec(Could not get deployment transaction for chaincode_example02 - LedgerError - ResourceNotFound: ledger: resource not found)"
  </code></pre>
  
  <p>Any idea?  I checked all logs under <code>/var</code> but didn't find anything useful, also checked <code>/var/hyperledger</code> and did see some updates under <code>/var/hyperledger/production/db</code>.  </p>
  
  <p>This trial seems pretty straight forwards but surprise to get an error.</p>
  
  <p>.. so how should I go about debugging this?</p>