Repository: onflow/flow-cli (go)

Issue:
Getter methods ByName() for contracts, accounts, networks does not return error in config package
### Instructions

pkg/flowkit/config there are getters for getting configured contracts, networks, accounts. These return an empty pointer if they are not found. It is tempting to then chain together method calls. However if you have then misconfigured things you will get not so nice error messages. 

Should we fix this so that these return error as seond argument?




Pull request:
Added errors to accessors methods in config
Closes #349 

## Description

<!--
Add a description of the changes that this PR introduces and the files that
are the most critical to review.
-->

______

For contributor use:

- [ ] Targeted PR against `master` branch
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work
- [ ] Code follows the [standards mentioned here](https://github.com/onflow/flow-cli/blob/master/CONTRIBUTING.md#styleguides)
- [ ] Updated relevant documentation
- [ ] Re-reviewed `Files changed` in the Github PR explorer
- [ ] Added appropriate labels


Patch:
diff --git a/go.mod b/go.mod
index d32893bb..fcede435 100644
--- a/go.mod
+++ b/go.mod
@@ -2,6 +2,8 @@ module github.com/onflow/flow-cli
 
 go 1.13
 
+replace github.com/onflow/cadence/languageserver => github.com/bjartek/cadence/languageserver v0.9.5-0.20210804215405-0397187261d5
+
 require (
 	github.com/a8m/envsubst v1.2.0
 	github.com/gosuri/uilive v0.0.4
diff --git a/go.sum b/go.sum
index e19deca3..7380a8d3 100644
--- a/go.sum
+++ b/go.sum
@@ -105,6 +105,8 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
 github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
 github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
 github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
+github.com/bjartek/cadence/languageserver v0.9.5-0.20210804215405-0397187261d5 h1:cvvYlnRqub6a1+pACPcbGT1feVqPWYxye9bWoThufp0=
+github.com/bjartek/cadence/languageserver v0.9.5-0.20210804215405-0397187261d5/go.mod h1:aKM/5oADoro8Y90/9N7DzHeVwQWDK8lCUtUUWXwg2zY=
 github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
 github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
 github.com/bsipos/thist v1.0.0/go.mod h1:7i0xwRua1/bmUxcxi2xAxaFL895rLtOpKUwnw3NrT8I=
@@ -223,7 +225,6 @@ github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
 github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
 github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
 github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
-github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ=
 github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag=
 github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
 github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY=
@@ -516,13 +517,11 @@ github.com/libp2p/go-libp2p v0.6.1/go.mod h1:CTFnWXogryAHjXAKEbOf1OWY+VeAP3lDMZk
 github.com/libp2p/go-libp2p v0.7.0/go.mod h1:hZJf8txWeCduQRDC/WSqBGMxaTHCOYHt2xSU1ivxn0k=
 github.com/libp2p/go-libp2p v0.7.4/go.mod h1:oXsBlTLF1q7pxr+9w6lqzS1ILpyHsaBPniVO7zIHGMw=
 github.com/libp2p/go-libp2p v0.8.1/go.mod h1:QRNH9pwdbEBpx5DTJYg+qxcVaDMAz3Ee/qDKwXujH5o=
-github.com/libp2p/go-libp2p v0.13.0/go.mod h1:pM0beYdACRfHO1WcJlp65WXyG2A6NqYM+t2DTVAJxMo=
 github.com/libp2p/go-libp2p v0.14.1/go.mod h1:0PQMADQEjCM2l8cSMYDpTgsb8gr6Zq7i4LUgq1mlW2E=
 github.com/libp2p/go-libp2p-autonat v0.1.1/go.mod h1:OXqkeGOY2xJVWKAGV2inNF5aKN/djNA3fdpCWloIudE=
 github.com/libp2p/go-libp2p-autonat v0.2.0/go.mod h1:DX+9teU4pEEoZUqR1PiMlqliONQdNbfzE1C718tcViI=
 github.com/libp2p/go-libp2p-autonat v0.2.1/go.mod h1:MWtAhV5Ko1l6QBsHQNSuM6b1sRkXrpk0/LqCr+vCVxI=
 github.com/libp2p/go-libp2p-autonat v0.2.2/go.mod h1:HsM62HkqZmHR2k1xgX34WuWDzk/nBwNHoeyyT4IWV6A=
-github.com/libp2p/go-libp2p-autonat v0.4.0/go.mod h1:YxaJlpr81FhdOv3W3BTconZPfhaYivRdf53g+S2wobk=
 github.com/libp2p/go-libp2p-autonat v0.4.2/go.mod h1:YxaJlpr81FhdOv3W3BTconZPfhaYivRdf53g+S2wobk=
 github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro=
 github.com/libp2p/go-libp2p-blankhost v0.1.4/go.mod h1:oJF0saYsAXQCSfDq254GMNmLNz6ZTHTOvtF4ZydUvwU=
@@ -565,7 +564,6 @@ github.com/libp2p/go-libp2p-mplex v0.4.1/go.mod h1:cmy+3GfqfM1PceHTLL7zQzAAYaryD
 github.com/libp2p/go-libp2p-nat v0.0.5/go.mod h1:1qubaE5bTZMJE+E/uu2URroMbzdubFz1ChgiN79yKPE=
 github.com/libp2p/go-libp2p-nat v0.0.6/go.mod h1:iV59LVhB3IkFvS6S6sauVTSOrNEANnINbI/fkaLimiw=
 github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU=
-github.com/libp2p/go-libp2p-noise v0.1.1/go.mod h1:QDFLdKX7nluB7DEnlVPbz7xlLHdwHFA9HiohJRr3vwM=
 github.com/libp2p/go-libp2p-noise v0.2.0/go.mod h1:IEbYhBBzGyvdLBoxxULL/SGbJARhUeqlO8lVSREYu2Q=
 github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY=
 github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY=
@@ -588,7 +586,6 @@ github.com/libp2p/go-libp2p-swarm v0.2.3/go.mod h1:P2VO/EpxRyDxtChXz/VPVXyTnszHv
 github.com/libp2p/go-libp2p-swarm v0.2.8/go.mod h1:JQKMGSth4SMqonruY0a8yjlPVIkb0mdNSwckW7OYziM=
 github.com/libp2p/go-libp2p-swarm v0.3.0/go.mod h1:hdv95GWCTmzkgeJpP+GK/9D9puJegb7H57B5hWQR5Kk=
 github.com/libp2p/go-libp2p-swarm v0.3.1/go.mod h1:hdv95GWCTmzkgeJpP+GK/9D9puJegb7H57B5hWQR5Kk=
-github.com/libp2p/go-libp2p-swarm v0.4.0/go.mod h1:XVFcO52VoLoo0eitSxNQWYq4D6sydGOweTOAjJNraCw=
 github.com/libp2p/go-libp2p-swarm v0.5.0/go.mod h1:sU9i6BoHE0Ve5SKz3y9WfKrh8dUat6JknzUehFx8xW4=
 github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E=
 github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E=
@@ -602,7 +599,6 @@ github.com/libp2p/go-libp2p-tls v0.1.3/go.mod h1:wZfuewxOndz5RTnCAxFliGjvYSDA40s
 github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA=
 github.com/libp2p/go-libp2p-transport-upgrader v0.2.0/go.mod h1:mQcrHj4asu6ArfSoMuyojOdjx73Q47cYD7s5+gZOlns=
 github.com/libp2p/go-libp2p-transport-upgrader v0.3.0/go.mod h1:i+SKzbRnvXdVbU3D1dwydnTmKRPXiAR/fyvi1dXuL4o=
-github.com/libp2p/go-libp2p-transport-upgrader v0.4.0/go.mod h1:J4ko0ObtZSmgn5BX5AmegP+dK3CSnU2lMCKsSq/EY0s=
 github.com/libp2p/go-libp2p-transport-upgrader v0.4.2/go.mod h1:NR8ne1VwfreD5VIWIU62Agt/J18ekORFU/j1i2y8zvk=
 github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8=
 github.com/libp2p/go-libp2p-yamux v0.2.2/go.mod h1:lIohaR0pT6mOt0AZ0L2dFze9hds9Req3OfS+B+dv4qw=
@@ -611,7 +607,6 @@ github.com/libp2p/go-libp2p-yamux v0.2.7/go.mod h1:X28ENrBMU/nm4I3Nx4sZ4dgjZ6VhL
 github.com/libp2p/go-libp2p-yamux v0.2.8/go.mod h1:/t6tDqeuZf0INZMTgd0WxIRbtK2EzI2h7HbFm9eAKI4=
 github.com/libp2p/go-libp2p-yamux v0.4.0/go.mod h1:+DWDjtFMzoAwYLVkNZftoucn7PelNoy5nm3tZ3/Zw30=
 github.com/libp2p/go-libp2p-yamux v0.5.0/go.mod h1:AyR8k5EzyM2QN9Bbdg6X1SkVVuqLwTGf0L4DFq9g6po=
-github.com/libp2p/go-libp2p-yamux v0.5.1/go.mod h1:dowuvDu8CRWmr0iqySMiSxK+W0iL5cMVO9S94Y6gkv4=
 github.com/libp2p/go-libp2p-yamux v0.5.4/go.mod h1:tfrXbyaTqqSU654GTvK3ocnSZL3BuHoeTSqhcel1wsE=
 github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q=
 github.com/libp2p/go-maddr-filter v0.0.5/go.mod h1:Jk+36PMfIqCJhAnaASRH83bdAvfDRp/w6ENFaC9bG+M=
@@ -659,7 +654,6 @@ github.com/libp2p/go-yamux v1.3.5/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZ
 github.com/libp2p/go-yamux v1.3.7/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE=
 github.com/libp2p/go-yamux v1.4.0/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE=
 github.com/libp2p/go-yamux v1.4.1/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE=
-github.com/libp2p/go-yamux/v2 v2.0.0/go.mod h1:NVWira5+sVUIU6tu1JWvaRn1dRnG+cawOJiflsAM+7U=
 github.com/libp2p/go-yamux/v2 v2.2.0/go.mod h1:3So6P6TV6r75R9jiBpiIKgU/66lOarCZjqROGxzPpPQ=
 github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
 github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
@@ -715,7 +709,6 @@ github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00v
 github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
 github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
 github.com/miekg/dns v1.1.28/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
-github.com/miekg/dns v1.1.31/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
 github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
 github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ=
 github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U=
@@ -807,22 +800,12 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn
 github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
 github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
 github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
-github.com/onflow/cadence v0.14.2/go.mod h1:EEXKRNuW5C2E1wRM4fLhfqoTgXohPFieXwOGJubz1Jg=
 github.com/onflow/cadence v0.15.0/go.mod h1:KMzDF6cIv6nb5PJW9aITaqazbmJX8MMeibFcpPP385M=
-github.com/onflow/cadence v0.15.1/go.mod h1:KMzDF6cIv6nb5PJW9aITaqazbmJX8MMeibFcpPP385M=
-github.com/onflow/cadence v0.16.0/go.mod h1:iR/tZpP+1YhM8iRnOBPiBIs7on5dE3hk2ZfunCRQswE=
 github.com/onflow/cadence v0.17.0/go.mod h1:iR/tZpP+1YhM8iRnOBPiBIs7on5dE3hk2ZfunCRQswE=
 github.com/onflow/cadence v0.18.0/go.mod h1:iR/tZpP+1YhM8iRnOBPiBIs7on5dE3hk2ZfunCRQswE=
-github.com/onflow/cadence v0.18.1-0.20210617175100-225316245130/go.mod h1:iR/tZpP+1YhM8iRnOBPiBIs7on5dE3hk2ZfunCRQswE=
 github.com/onflow/cadence v0.18.1-0.20210621144040-64e6b6fb2337 h1:s5KgNVr8hUiNm0aM4IQuuntH+NHZGxUx2maYLOzuShY=
 github.com/onflow/cadence v0.18.1-0.20210621144040-64e6b6fb2337/go.mod h1:iR/tZpP+1YhM8iRnOBPiBIs7on5dE3hk2ZfunCRQswE=
-github.com/onflow/cadence/languageserver v0.15.2/go.mod h1:hQGE8dYH5CfQ1Oe0nXglchgURzZwR3JQhmuXtv4ROHs=
-github.com/onflow/cadence/languageserver v0.16.0/go.mod h1:UPV1so9LcMrhj27IegrTucoyS4TLRVjNr4DJqjqBhFA=
-github.com/onflow/cadence/languageserver v0.18.2 h1:qO7nCUUBzYWiM48iocmMMAYAnoQhYioSB5BNanZzr5A=
-github.com/onflow/cadence/languageserver v0.18.2/go.mod h1:ehuDCUevEEavUzgJqLevcZPjfmTzMBX7Sglbi5ur9uU=
-github.com/onflow/flow-cli v0.20.3-0.20210512000809-474effb7e7db/go.mod h1:Yh4dgrNiZdXhbU+3UVUmo4gRM0TEBVvhW4ITKVo82dg=
 github.com/onflow/flow-cli v0.23.1-0.20210621124332-11c4cd22ffb4/go.mod h1:OD9UVPFIvktnO86dSLavf1tTVFIsKQ5By5KBBDLfC3Q=
-github.com/onflow/flow-core-contracts/lib/go/contracts v0.7.2/go.mod h1:IZ2e7UyLCYmpQ8Kd7k0A32uXqdqfiV1r2sKs5/riblo=
 github.com/onflow/flow-core-contracts/lib/go/contracts v0.7.3-0.20210527134022-58c25247091a/go.mod h1:IZ2e7UyLCYmpQ8Kd7k0A32uXqdqfiV1r2sKs5/riblo=
 github.com/onflow/flow-core-contracts/lib/go/contracts v0.7.3 h1:Rxu1KvTPlSfR0pneog/r1HkS4fszJL2AS28QK4qHOTQ=
 github.com/onflow/flow-core-contracts/lib/go/contracts v0.7.3/go.mod h1:MSNt2rodpRXm1n0iGQWL6ltDoJCtXEzlPw9nhE/zQmk=
@@ -830,14 +813,11 @@ github.com/onflow/flow-core-contracts/lib/go/templates v0.6.0 h1:2v10ZSCE4e3TyeD
 github.com/onflow/flow-core-contracts/lib/go/templates v0.6.0 h1:2v10ZSCE4e3TyeDQvKplGJ4/d0X/+xgU2NmeXRmFYRw=
 github.com/onflow/flow-core-contracts/lib/go/templates v0.6.0/go.mod h1:fLJbjGUHrlHdrjaeRDgKG9nZJ6spiCScc+Q5SARgH38=
 github.com/onflow/flow-core-contracts/lib/go/templates v0.6.0/go.mod h1:fLJbjGUHrlHdrjaeRDgKG9nZJ6spiCScc+Q5SARgH38=
-github.com/onflow/flow-emulator v0.19.0/go.mod h1:k5un51XlFJavboagCqTxd6x8Gle7lxWlXdUepoNB5fA=
 github.com/onflow/flow-emulator v0.21.0/go.mod h1:/2dNG6K4fKtpZsazdIeK8Fs0IWXUzqvO3qK5467pYsc=
 github.com/onflow/flow-emulator v0.22.0 h1:K+OvKLOPxJjWC+rgrl0zVuLpg72E3Sjp+wS8Vg2X8XQ=
 github.com/onflow/flow-emulator v0.22.0/go.mod h1:zDnU3NLgB/jzvLZykaldmuX2tTImivu5G4in8ntAUTY=
 github.com/onflow/flow-ft/lib/go/contracts v0.5.0 h1:Cg4gHGVblxcejfNNG5Mfj98Wf4zbY76O0Y28QB0766A=
 github.com/onflow/flow-ft/lib/go/contracts v0.5.0/go.mod h1:1zoTjp1KzNnOPkyqKmWKerUyf0gciw+e6tAEt0Ks3JE=
-github.com/onflow/flow-go v0.16.3-0.20210427194927-6050c2a3ae42/go.mod h1:9GUEbBhOGDVf91ZJB6QWqVNQkrM3INEudNyDtIttOu0=
-github.com/onflow/flow-go v0.17.1/go.mod h1:j8zCo01+2pJL00qpOnwdOqU7spTgOLHFRUp9gsamyNA=
 github.com/onflow/flow-go v0.18.0/go.mod h1:cQpvFoqth9PR7tarWDa36R/dDOqUK5QYfeYzCdXPLII=
 github.com/onflow/flow-go v0.18.2-canary/go.mod h1:mGzTPbzG1YrckrFQfjCw6NzfflP1o3TjRxI9LRWZbpc=
 github.com/onflow/flow-go v0.18.4 h1:2VHCT+e8oo5jrAYyYLdHga6in8FcbXd6tqiQjg9YPz0=
@@ -1009,7 +989,6 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU
 github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
 github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
 github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
-github.com/spf13/cobra v0.0.7/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
 github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M=
 github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
 github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
@@ -1140,7 +1119,6 @@ golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPh
 golang.org/x/crypto v0.0.0-20200117160349-530e935923ad/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
diff --git a/internal/command/command.go b/internal/command/command.go
index cbe66f9b..7f1fd7ab 100644
--- a/internal/command/command.go
+++ b/internal/command/command.go
@@ -158,22 +158,23 @@ func resolveHost(state *flowkit.State, hostFlag string, networkFlag string) (str
 	}
 	// network flag with project initialized is next
 	if state != nil {
-		check := state.Networks().ByName(networkFlag)
-		if check == nil {
+		stateNetwork, err := state.Networks().ByName(networkFlag)
+		if err != nil {
 			return "", fmt.Errorf("network with name %s does not exist in configuration", networkFlag)
 		}
 
-		return state.Networks().ByName(networkFlag).Host, nil
+		return stateNetwork.Host, nil
 	}
 
 	networks := config.DefaultNetworks()
-	network := networks.ByName(networkFlag)
+	network, err := networks.ByName(networkFlag)
 
-	if network != nil {
-		return network.Host, nil
+	if err != nil {
+		return "", fmt.Errorf("invalid network with name %s", networkFlag)
 	}
 
-	return "", fmt.Errorf("invalid network with name %s", networkFlag)
+	return network.Host, nil
+
 }
 
 // create logger utility.
diff --git a/pkg/flowkit/config/account.go b/pkg/flowkit/config/account.go
index 6404c468..051e633f 100644
--- a/pkg/flowkit/config/account.go
+++ b/pkg/flowkit/config/account.go
@@ -19,6 +19,8 @@
 package config
 
 import (
+	"fmt"
+
 	"github.com/onflow/flow-go-sdk"
 	"github.com/onflow/flow-go-sdk/crypto"
 )
@@ -43,14 +45,14 @@ type AccountKey struct {
 }
 
 // ByName get account by name.
-func (a *Accounts) ByName(name string) *Account {
+func (a *Accounts) ByName(name string) (*Account, error) {
 	for _, account := range *a {
 		if account.Name == name {
-			return &account
+			return &account, nil
 		}
 	}
 
-	return nil
+	return nil, fmt.Errorf("account with name %s is not present in configuration", name)
 }
 
 // AddOrUpdate add new or update if already present.
diff --git a/pkg/flowkit/config/config.go b/pkg/flowkit/config/config.go
index 12541827..516e4b38 100644
--- a/pkg/flowkit/config/config.go
+++ b/pkg/flowkit/config/config.go
@@ -52,29 +52,34 @@ const (
 // Validate the configuration values.
 func (c *Config) Validate() error {
 	for _, con := range c.Contracts {
-		if con.Network != "" && c.Networks.ByName(con.Network) == nil {
+		_, err := c.Networks.ByName(con.Network)
+		if con.Network != "" && err != nil {
 			return fmt.Errorf("contract %s contains nonexisting network %s", con.Name, con.Network)
 		}
 	}
 
 	for _, em := range c.Emulators {
-		if c.Accounts.ByName(em.ServiceAccount) == nil {
+		_, err := c.Accounts.ByName(em.ServiceAccount)
+		if err != nil {
 			return fmt.Errorf("emulator %s contains nonexisting service account %s", em.Name, em.ServiceAccount)
 		}
 	}
 
 	for _, d := range c.Deployments {
-		if c.Networks.ByName(d.Network) == nil {
+		_, err := c.Networks.ByName(d.Network)
+		if err != nil {
 			return fmt.Errorf("deployment contains nonexisting network %s", d.Network)
 		}
 
 		for _, con := range d.Contracts {
-			if c.Contracts.ByName(con.Name) == nil {
+			_, err := c.Contracts.ByName(con.Name)
+			if err != nil {
 				return fmt.Errorf("deployment contains nonexisting contract %s", con.Name)
 			}
 		}
 
-		if c.Accounts.ByName(d.Account) == nil {
+		_, err = c.Accounts.ByName(d.Account)
+		if err != nil {
 			return fmt.Errorf("deployment contains nonexisting account %s", d.Account)
 		}
 	}
diff --git a/pkg/flowkit/config/contract.go b/pkg/flowkit/config/contract.go
index 580f6625..64bd5255 100644
--- a/pkg/flowkit/config/contract.go
+++ b/pkg/flowkit/config/contract.go
@@ -36,36 +36,36 @@ func (c *Contract) IsAlias() bool {
 }
 
 // ByNameAndNetwork get contract array for account and network.
-func (c *Contracts) ByNameAndNetwork(name string, network string) *Contract {
+func (c *Contracts) ByNameAndNetwork(name string, network string) (*Contract, error) {
 	for _, contract := range *c {
 		if contract.Network == network && contract.Name == name {
-			return &contract
+			return &contract, nil
 		}
 	}
 
 	// if we don't find contract by name and network create a new contract
 	// and replace only name and source with existing
-	cName := c.ByName(name)
-	if cName == nil {
-		return nil
+	cName, err := c.ByName(name)
+	if err != nil {
+		return nil, err
 	}
 
 	return &Contract{
 		Name:    cName.Name,
 		Network: network,
 		Source:  cName.Source,
-	}
+	}, nil
 }
 
 // ByName get contract by name.
-func (c *Contracts) ByName(name string) *Contract {
+func (c *Contracts) ByName(name string) (*Contract, error) {
 	for _, contract := range *c {
 		if contract.Name == name {
-			return &contract
+			return &contract, nil
 		}
 	}
 
-	return nil
+	return nil, fmt.Errorf("contract named %s does not exist in configuration", name)
 }
 
 // ByNetwork returns all contracts for specific network.
@@ -96,9 +96,9 @@ func (c *Contracts) AddOrUpdate(name string, contract Contract) {
 
 // Remove contract by its name.
 func (c *Contracts) Remove(name string) error {
-	contract := c.ByName(name)
-	if contract == nil {
-		return fmt.Errorf("contract named %s does not exist in configuration", name)
+	_, err := c.ByName(name)
+	if err != nil {
+		return err
 	}
 
 	for i, contract := range *c {
diff --git a/pkg/flowkit/config/loader.go b/pkg/flowkit/config/loader.go
index 77392c36..5878ffbe 100644
--- a/pkg/flowkit/config/loader.go
+++ b/pkg/flowkit/config/loader.go
@@ -198,9 +198,14 @@ func (l *Loader) postprocess(baseConf *Config) (*Config, error) {
 			return nil, err
 		}
 
+		account, err := conf.Accounts.ByName(name)
+		if err != nil {
+			return nil, err
+		}
+
 		// create an empty config with single account so we don't include all accounts in file
 		accountConf := &Config{
-			Accounts: []Account{*conf.Accounts.ByName(name)},
+			Accounts: []Account{*account},
 		}
 
 		l.composeConfig(baseConf, accountConf)
diff --git a/pkg/flowkit/config/network.go b/pkg/flowkit/config/network.go
index efbf5a3d..931a90b0 100644
--- a/pkg/flowkit/config/network.go
+++ b/pkg/flowkit/config/network.go
@@ -31,14 +31,14 @@ type Network struct {
 }
 
 // ByName get network by name.
-func (n *Networks) ByName(name string) *Network {
+func (n *Networks) ByName(name string) (*Network, error) {
 	for _, network := range *n {
 		if network.Name == name {
-			return &network
+			return &network, nil
 		}
 	}
 
-	return nil
+	return nil, fmt.Errorf("network named %s does not exist in configuration", name)
 }
 
 // AddOrUpdate add new network or update if already present.
@@ -55,9 +55,9 @@ func (n *Networks) AddOrUpdate(name string, network Network) {
 
 // Remove network by the name.
 func (n *Networks) Remove(name string) error {
-	network := n.ByName(name)
-	if network == nil {
-		return fmt.Errorf("network named %s does not exist in configuration", name)
+	_, err := n.ByName(name)
+	if err != nil {
+		return err
 	}
 
 	for i, network := range *n {
diff --git a/pkg/flowkit/services/status.go b/pkg/flowkit/services/status.go
index 08bc50bb..717e873b 100644
--- a/pkg/flowkit/services/status.go
+++ b/pkg/flowkit/services/status.go
@@ -47,7 +47,13 @@ func NewStatus(
 // Ping sends Ping request to network.
 func (s *Status) Ping(network string) (string, error) {
 	err := s.gateway.Ping()
-	accessNode := s.state.Networks().ByName(network).Host
+	if err != nil {
+		return "", err
+	}
+	n, err := s.state.Networks().ByName(network)
+	if err != nil {
+		return "", err
+	}
 
-	return accessNode, err
+	return n.Host, nil
 }
diff --git a/pkg/flowkit/state.go b/pkg/flowkit/state.go
index 549b45f1..1bfb0b94 100644
--- a/pkg/flowkit/state.go
+++ b/pkg/flowkit/state.go
@@ -168,9 +168,9 @@ func (p *State) DeploymentContractsByNetwork(network string) ([]Contract, error)
 
 		// go through each contract in this deployment
 		for _, deploymentContract := range deploy.Contracts {
-			c := p.conf.Contracts.ByNameAndNetwork(deploymentContract.Name, network)
-			if c == nil {
-				return nil, fmt.Errorf("could not find contract with name name %s in the configuration", deploymentContract.Name)
+			c, err := p.conf.Contracts.ByNameAndNetwork(deploymentContract.Name, network)
+			if err != nil {
+				return nil, err
 			}
 
 			contract := Contract{


Test patch:
diff --git a/pkg/flowkit/config/config_test.go b/pkg/flowkit/config/config_test.go
index 1c73f611..0f8e5231 100644
--- a/pkg/flowkit/config/config_test.go
+++ b/pkg/flowkit/config/config_test.go
@@ -136,8 +136,10 @@ func generateComplexConfig() config.Config {
 
 func Test_GetContractsForNetworkComplex(t *testing.T) {
 	conf := generateComplexConfig()
-	kitty := conf.Contracts.ByName("KittyItems")
-	market := conf.Contracts.ByName("KittyItemsMarket")
+	kitty, err := conf.Contracts.ByName("KittyItems")
+	assert.NoError(t, err)
+	market, err := conf.Contracts.ByName("KittyItemsMarket")
+	assert.NoError(t, err)
 
 	assert.Equal(t, kitty.Name, "KittyItems")
 	assert.Equal(t, market.Source, "./cadence/kittyItemsMarket/contracts/KittyItemsMarket.cdc")
@@ -145,7 +147,8 @@ func Test_GetContractsForNetworkComplex(t *testing.T) {
 
 func Test_GetContractsByNameAndNetworkComplex(t *testing.T) {
 	conf := generateComplexConfig()
-	market := conf.Contracts.ByNameAndNetwork("KittyItemsMarket", "testnet")
+	market, err := conf.Contracts.ByNameAndNetwork("KittyItemsMarket", "testnet")
+	assert.NoError(t, err)
 
 	assert.Equal(t, market.Source, "0x123123123")
 }
@@ -164,7 +167,8 @@ func Test_GetContractsByNetworkComplex(t *testing.T) {
 
 func Test_GetAccountByNameComplex(t *testing.T) {
 	conf := generateComplexConfig()
-	acc := conf.Accounts.ByName("account-4")
+	acc, err := conf.Accounts.ByName("account-4")
+	assert.NoError(t, err)
 
 	assert.Equal(t, acc.Address.String(), "f8d6e0586b0a20c1")
 }
@@ -183,7 +187,8 @@ func Test_GetDeploymentsByNetworkComplex(t *testing.T) {
 
 func Test_GetNetworkByNameComplex(t *testing.T) {
 	conf := generateComplexConfig()
-	network := conf.Networks.ByName("emulator")
+	network, err := conf.Networks.ByName("emulator")
 
+	assert.NoError(t, err)
 	assert.Equal(t, network.Host, "127.0.0.1.3569")
 }
diff --git a/pkg/flowkit/config/json/account_test.go b/pkg/flowkit/config/json/account_test.go
index 416a6bc4..0eb36b65 100644
--- a/pkg/flowkit/config/json/account_test.go
+++ b/pkg/flowkit/config/json/account_test.go
@@ -39,7 +39,8 @@ func Test_ConfigAccountKeysSimple(t *testing.T) {
 	accounts, err := jsonAccounts.transformToConfig()
 	assert.NoError(t, err)
 
-	account := accounts.ByName("test")
+	account, err := accounts.ByName("test")
+	assert.NoError(t, err)
 	key := account.Key
 
 	assert.Equal(t, account.Address.String(), "f8d6e0586b0a20c7")
@@ -70,7 +71,8 @@ func Test_ConfigAccountKeysAdvancedHex(t *testing.T) {
 	accounts, err := jsonAccounts.transformToConfig()
 	assert.NoError(t, err)
 
-	account := accounts.ByName("test")
+	account, err := accounts.ByName("test")
+	assert.NoError(t, err)
 	key := account.Key
 
 	assert.Equal(t, account.Address.String(), "f8d6e0586b0a20c7")
@@ -102,7 +104,8 @@ func Test_ConfigAccountKeysAdvancedKMS(t *testing.T) {
 	accounts, err := jsonAccounts.transformToConfig()
 	assert.NoError(t, err)
 
-	account := accounts.ByName("test")
+	account, err := accounts.ByName("test")
+	assert.NoError(t, err)
 	key := account.Key
 
 	assert.Equal(t, account.Address.String(), "f8d6e0586b0a20c7")
@@ -140,7 +143,8 @@ func Test_ConfigAccountOldFormats(t *testing.T) {
 	accounts, err := jsonAccounts.transformToConfig()
 	assert.NoError(t, err)
 
-	account := accounts.ByName("old-format-1")
+	account, err := accounts.ByName("old-format-1")
+	assert.NoError(t, err)
 	key := account.Key
 
 	assert.Equal(t, account.Address.String(), "f8d6e0586b0a20c7")
@@ -149,7 +153,8 @@ func Test_ConfigAccountOldFormats(t *testing.T) {
 	assert.Equal(t, key.SigAlgo.String(), "ECDSA_P256")
 	assert.Equal(t, key.PrivateKey.String(), "0xf988fd7a959d96d0e36ca13a240bbfc4a78098cc56cfd1fa6c918080c8a0f55c")
 
-	account = accounts.ByName("old-format-2")
+	account, err = accounts.ByName("old-format-2")
+	assert.NoError(t, err)
 	key = account.Key
 
 	assert.Equal(t, account.Address.String(), "f8d6e0586b0a20c7")
@@ -178,7 +183,9 @@ func Test_ConfigMultipleAccountsSimple(t *testing.T) {
 	accounts, err := jsonAccounts.transformToConfig()
 	assert.NoError(t, err)
 
-	account := accounts.ByName("emulator-account")
+	account, err := accounts.ByName("emulator-account")
+	assert.NoError(t, err)
+
 	key := account.Key
 
 	assert.Equal(t, account.Name, "emulator-account")
@@ -188,7 +195,8 @@ func Test_ConfigMultipleAccountsSimple(t *testing.T) {
 	assert.Equal(t, key.SigAlgo.String(), "ECDSA_P256")
 	assert.Equal(t, key.PrivateKey.String(), "0xdd72967fd2bd75234ae9037dd4694c1f00baad63a10c35172bf65fbb8ad74b47")
 
-	account = accounts.ByName("testnet-account")
+	account, err = accounts.ByName("testnet-account")
+	assert.NoError(t, err)
 	key = account.Key
 
 	assert.Equal(t, account.Address.String(), "2c1162386b0a245f")
@@ -229,7 +237,8 @@ func Test_ConfigMultipleAccountsAdvanced(t *testing.T) {
 	accounts, err := jsonAccounts.transformToConfig()
 	assert.NoError(t, err)
 
-	account := accounts.ByName("emulator-account")
+	account, err := accounts.ByName("emulator-account")
+	assert.NoError(t, err)
 	key := account.Key
 
 	assert.Equal(t, account.Address.String(), "f8d6e0586b0a20c7")
@@ -239,7 +248,8 @@ func Test_ConfigMultipleAccountsAdvanced(t *testing.T) {
 	assert.NotNil(t, key.PrivateKey)
 	assert.Equal(t, key.PrivateKey.String(), "0x1272967fd2bd75234ae9037dd4694c1f00baad63a10c35172bf65fbb8ad74b47")
 
-	account = accounts.ByName("testnet-account")
+	account, err = accounts.ByName("testnet-account")
+	assert.NoError(t, err)
 	key = account.Key
 
 	assert.Equal(t, account.Address.String(), "1c1162386b0a245f")
@@ -275,7 +285,8 @@ func Test_ConfigMixedAccounts(t *testing.T) {
 	accounts, err := jsonAccounts.transformToConfig()
 	assert.NoError(t, err)
 
-	account := accounts.ByName("emulator-account")
+	account, err := accounts.ByName("emulator-account")
+	assert.NoError(t, err)
 	key := account.Key
 
 	assert.Equal(t, account.Address.String(), "f8d6e0586b0a20c7")
@@ -284,7 +295,8 @@ func Test_ConfigMixedAccounts(t *testing.T) {
 	assert.Equal(t, key.SigAlgo.String(), "ECDSA_P256")
 	assert.Equal(t, key.PrivateKey.String(), "0x1272967fd2bd75234ae9037dd4694c1f00baad63a10c35172bf65fbb8ad74b47")
 
-	account = accounts.ByName("testnet-account")
+	account, err = accounts.ByName("testnet-account")
+	assert.NoError(t, err)
 	key = account.Key
 
 	assert.Equal(t, account.Address.String(), "3c1162386b0a245f")
@@ -312,9 +324,10 @@ func Test_ConfigAccountsMap(t *testing.T) {
 
 	accounts, err := jsonAccounts.transformToConfig()
 	assert.NoError(t, err)
-
-	assert.Equal(t, accounts.ByName("emulator-account").Address.String(), "f8d6e0586b0a20c7")
-	assert.Equal(t, accounts.ByName("emulator-account").Name, "emulator-account")
+	emulatorAccount, err := accounts.ByName("emulator-account")
+	assert.NoError(t, err)
+	assert.Equal(t, emulatorAccount.Address.String(), "f8d6e0586b0a20c7")
+	assert.Equal(t, emulatorAccount.Name, "emulator-account")
 }
 
 func Test_TransformDefaultAccountToJSON(t *testing.T) {
@@ -389,10 +402,14 @@ func Test_SupportForOldFormatWithMultipleKeys(t *testing.T) {
 	conf, err := jsonAccounts.transformToConfig()
 	assert.NoError(t, err)
 
-	key := conf.ByName("testnet-account").Key
+	account, err := conf.ByName("testnet-account")
+	assert.NoError(t, err)
+	key := account.Key
 	assert.Equal(t, key.PrivateKey.String(), "0x1272967fd2bd75234ae9037dd4694c1f00baad63a10c35172bf65fbb8ad74b47")
 
-	key = conf.ByName("emulator-account").Key
+	emulatorAccount, err := conf.ByName("emulator-account")
+	assert.NoError(t, err)
+	key = emulatorAccount.Key
 	assert.Equal(t, key.PrivateKey.String(), "0xdd72967fd2bd75234ae9037dd4694c1f00baad63a10c35172bf65fbb8ad74b47")
 }
 
diff --git a/pkg/flowkit/config/json/config_test.go b/pkg/flowkit/config/json/config_test.go
index 978cb803..e8041a4a 100644
--- a/pkg/flowkit/config/json/config_test.go
+++ b/pkg/flowkit/config/json/config_test.go
@@ -51,7 +51,9 @@ func Test_SimpleJSONConfig(t *testing.T) {
 	assert.Equal(t, 1, len(conf.Accounts))
 	assert.Equal(t, "emulator-account", conf.Accounts[0].Name)
 	assert.Equal(t, "0x11c5dfdeb0ff03a7a73ef39788563b62c89adea67bbb21ab95e5f710bd1d40b7", conf.Accounts[0].Key.PrivateKey.String())
-	assert.Equal(t, "127.0.0.1:3569", conf.Networks.ByName("emulator").Host)
+	network, err := conf.Networks.ByName("emulator")
+	assert.NoError(t, err)
+	assert.Equal(t, "127.0.0.1:3569", network.Host)
 }
 
 func Test_NonExistingContractForDeployment(t *testing.T) {
diff --git a/pkg/flowkit/config/json/contract_test.go b/pkg/flowkit/config/json/contract_test.go
index 2d5acb68..0cc9f6ca 100644
--- a/pkg/flowkit/config/json/contract_test.go
+++ b/pkg/flowkit/config/json/contract_test.go
@@ -37,8 +37,14 @@ func Test_ConfigContractsSimple(t *testing.T) {
 	contracts, err := jsonContracts.transformToConfig()
 	assert.NoError(t, err)
 
-	assert.Equal(t, "./cadence/kittyItems/contracts/KittyItems.cdc", contracts.ByName("KittyItems").Source)
-	assert.Equal(t, "./cadence/kittyItems/contracts/KittyItemsMarket.cdc", contracts.ByName("KittyItemsMarket").Source)
+	contract, err := contracts.ByName("KittyItems")
+	assert.NoError(t, err)
+
+	marketContract, err := contracts.ByName("KittyItemsMarket")
+	assert.NoError(t, err)
+
+	assert.Equal(t, "./cadence/kittyItems/contracts/KittyItems.cdc", contract.Source)
+	assert.Equal(t, "./cadence/kittyItems/contracts/KittyItemsMarket.cdc", marketContract.Source)
 }
 
 func Test_ConfigContractsComplex(t *testing.T) {
@@ -61,15 +67,29 @@ func Test_ConfigContractsComplex(t *testing.T) {
 
 	assert.Equal(t, len(contracts), 2)
 
-	assert.Equal(t, contracts.ByName("KittyItems").Source, "./cadence/kittyItems/contracts/KittyItems.cdc")
-	assert.Equal(t, contracts.ByNameAndNetwork("KittyItemsMarket", "emulator").Source, "./cadence/kittyItemsMarket/contracts/KittyItemsMarket.cdc")
-	assert.Equal(t, contracts.ByNameAndNetwork("KittyItemsMarket", "testnet").Source, "./cadence/kittyItemsMarket/contracts/KittyItemsMarket.cdc")
+	contract, err := contracts.ByName("KittyItems")
+	assert.NoError(t, err)
+	kittyItemsMarketEmulator, err := contracts.ByNameAndNetwork("KittyItemsMarket", "emulator")
+	assert.NoError(t, err)
+
+	kittyItemsMarketTestnet, err := contracts.ByNameAndNetwork("KittyItemsMarket", "testnet")
+	assert.NoError(t, err)
+
+	assert.Equal(t, contract.Source, "./cadence/kittyItems/contracts/KittyItems.cdc")
+	assert.Equal(t, kittyItemsMarketEmulator.Source, "./cadence/kittyItemsMarket/contracts/KittyItemsMarket.cdc")
+	assert.Equal(t, kittyItemsMarketTestnet.Source, "./cadence/kittyItemsMarket/contracts/KittyItemsMarket.cdc")
 
-	assert.Equal(t, contracts.ByNameAndNetwork("KittyItems", "emulator").Alias, "")
-	assert.Equal(t, contracts.ByNameAndNetwork("KittyItems", "testnet").Alias, "")
+	kittyItemsEmulator, err := contracts.ByNameAndNetwork("KittyItems", "emulator")
+	assert.NoError(t, err)
+
+	kittyItemsTestnet, err := contracts.ByNameAndNetwork("KittyItems", "testnet")
+	assert.NoError(t, err)
 
-	assert.Equal(t, contracts.ByNameAndNetwork("KittyItemsMarket", "testnet").Alias, "f8d6e0586b0a20c7")
-	assert.Equal(t, contracts.ByNameAndNetwork("KittyItemsMarket", "emulator").Alias, "")
+	assert.Equal(t, kittyItemsEmulator.Alias, "")
+	assert.Equal(t, kittyItemsTestnet.Alias, "")
+
+	assert.Equal(t, kittyItemsMarketTestnet.Alias, "f8d6e0586b0a20c7")
+	assert.Equal(t, kittyItemsMarketEmulator.Alias, "")
 }
 
 func Test_ConfigContractsAliases(t *testing.T) {
@@ -97,23 +117,39 @@ func Test_ConfigContractsAliases(t *testing.T) {
 	contracts, err := jsonContracts.transformToConfig()
 	assert.NoError(t, err)
 
-	assert.Equal(t, contracts.ByName("FungibleToken").Network, "emulator")
-	assert.Equal(t, contracts.ByName("FungibleToken").Alias, "e5a8b7f23e8b548f")
-	assert.Equal(t, contracts.ByName("FungibleToken").Source, "../hungry-kitties/cadence/contracts/FungibleToken.cdc")
-	assert.Equal(t, contracts.ByNameAndNetwork("FungibleToken", "emulator").Alias, "e5a8b7f23e8b548f")
-	assert.Equal(t, contracts.ByNameAndNetwork("FungibleToken", "testnet").Alias, "")
-	assert.Equal(t, contracts.ByNameAndNetwork("FungibleToken", "testnet").Network, "testnet")
-	assert.Equal(t, contracts.ByNameAndNetwork("FungibleToken", "testnet").Source, "../hungry-kitties/cadence/contracts/FungibleToken.cdc")
-	assert.Equal(t, contracts.ByNameAndNetwork("FungibleToken", "emulator").Source, "../hungry-kitties/cadence/contracts/FungibleToken.cdc")
+	fungibleToken, err := contracts.ByName("FungibleToken")
+	assert.NoError(t, err)
+	fungibleTokenEmulator, err := contracts.ByNameAndNetwork("FungibleToken", "emulator")
+	assert.NoError(t, err)
+
+	fungibleTokenTestnet, err := contracts.ByNameAndNetwork("FungibleToken", "testnet")
+	assert.NoError(t, err)
+
+	assert.Equal(t, fungibleToken.Network, "emulator")
+	assert.Equal(t, fungibleToken.Alias, "e5a8b7f23e8b548f")
+	assert.Equal(t, fungibleToken.Source, "../hungry-kitties/cadence/contracts/FungibleToken.cdc")
+	assert.Equal(t, fungibleTokenEmulator.Alias, "e5a8b7f23e8b548f")
+	assert.Equal(t, fungibleTokenTestnet.Alias, "")
+	assert.Equal(t, fungibleTokenTestnet.Network, "testnet")
+	assert.Equal(t, fungibleTokenTestnet.Source, "../hungry-kitties/cadence/contracts/FungibleToken.cdc")
+	assert.Equal(t, fungibleTokenEmulator.Source, "../hungry-kitties/cadence/contracts/FungibleToken.cdc")
 
-	assert.Equal(t, contracts.ByNameAndNetwork("Kibble", "testnet").Network, "testnet")
-	assert.Equal(t, contracts.ByNameAndNetwork("Kibble", "testnet").Alias, "ead892083b3e2c6c")
-	assert.Equal(t, contracts.ByNameAndNetwork("Kibble", "emulator").Alias, "f8d6e0586b0a20c7")
-	assert.Equal(t, contracts.ByNameAndNetwork("Kibble", "testnet").Source, "../hungry-kitties/cadence/contracts/Kibble.cdc")
+	kibbleTestnet, err := contracts.ByNameAndNetwork("Kibble", "testnet")
+	assert.NoError(t, err)
+
+	kibbleEmulator, err := contracts.ByNameAndNetwork("Kibble", "emulator")
+	assert.NoError(t, err)
+
+	assert.Equal(t, kibbleTestnet.Network, "testnet")
+	assert.Equal(t, kibbleTestnet.Alias, "ead892083b3e2c6c")
+	assert.Equal(t, kibbleEmulator.Alias, "f8d6e0586b0a20c7")
+	assert.Equal(t, kibbleTestnet.Source, "../hungry-kitties/cadence/contracts/Kibble.cdc")
+	nftTestnet, err := contracts.ByNameAndNetwork("NonFungibleToken", "testnet")
+	assert.NoError(t, err)
 
-	assert.Equal(t, contracts.ByNameAndNetwork("NonFungibleToken", "testnet").Network, "testnet")
-	assert.Equal(t, contracts.ByNameAndNetwork("NonFungibleToken", "testnet").Alias, "")
-	assert.Equal(t, contracts.ByNameAndNetwork("NonFungibleToken", "testnet").Source, "../hungry-kitties/cadence/contracts/NonFungibleToken.cdc")
+	assert.Equal(t, nftTestnet.Network, "testnet")
+	assert.Equal(t, nftTestnet.Alias, "")
+	assert.Equal(t, nftTestnet.Source, "../hungry-kitties/cadence/contracts/NonFungibleToken.cdc")
 }
 
 func Test_TransformContractToJSON(t *testing.T) {
diff --git a/pkg/flowkit/config/json/network_test.go b/pkg/flowkit/config/json/network_test.go
index 503cba1a..3ad2d163 100644
--- a/pkg/flowkit/config/json/network_test.go
+++ b/pkg/flowkit/config/json/network_test.go
@@ -36,8 +36,10 @@ func Test_ConfigNetworkSimple(t *testing.T) {
 	networks, err := jsonNetworks.transformToConfig()
 	assert.NoError(t, err)
 
-	assert.Equal(t, networks.ByName("testnet").Host, "access.testnet.nodes.onflow.org:9000")
-	assert.Equal(t, networks.ByName("testnet").Name, "testnet")
+	network, err := networks.ByName("testnet")
+	assert.NoError(t, err)
+	assert.Equal(t, network.Host, "access.testnet.nodes.onflow.org:9000")
+	assert.Equal(t, network.Name, "testnet")
 }
 
 func Test_ConfigNetworkMultiple(t *testing.T) {
@@ -53,11 +55,15 @@ func Test_ConfigNetworkMultiple(t *testing.T) {
 	networks, err := jsonNetworks.transformToConfig()
 	assert.NoError(t, err)
 
-	assert.Equal(t, networks.ByName("testnet").Host, "access.testnet.nodes.onflow.org:9000")
-	assert.Equal(t, networks.ByName("testnet").Name, "testnet")
+	network, err := networks.ByName("testnet")
+	assert.NoError(t, err)
+	assert.Equal(t, network.Host, "access.testnet.nodes.onflow.org:9000")
+	assert.Equal(t, network.Name, "testnet")
 
-	assert.Equal(t, networks.ByName("emulator").Name, "emulator")
-	assert.Equal(t, networks.ByName("emulator").Host, "127.0.0.1:3569")
+	emulator, err := networks.ByName("emulator")
+	assert.NoError(t, err)
+	assert.Equal(t, emulator.Name, "emulator")
+	assert.Equal(t, emulator.Host, "127.0.0.1:3569")
 }
 
 func Test_TransformNetworkToJSON(t *testing.T) {
@@ -94,6 +100,13 @@ func Test_IngoreOldFormat(t *testing.T) {
 	assert.NoError(t, err)
 
 	assert.Len(t, jsonNetworks, 3)
-	assert.Equal(t, conf.ByName("testnet").Host, "access.testnet.nodes.onflow.org:9000")
-	assert.Equal(t, conf.ByName("mainnet").Host, "access.mainnet.nodes.onflow.org:9000")
+
+	testnet, err := conf.ByName("testnet")
+	assert.NoError(t, err)
+
+	mainnet, err := conf.ByName("mainnet")
+	assert.NoError(t, err)
+
+	assert.Equal(t, testnet.Host, "access.testnet.nodes.onflow.org:9000")
+	assert.Equal(t, mainnet.Host, "access.mainnet.nodes.onflow.org:9000")
 }
diff --git a/pkg/flowkit/config/loader_test.go b/pkg/flowkit/config/loader_test.go
index 817bead3..4d421ec9 100644
--- a/pkg/flowkit/config/loader_test.go
+++ b/pkg/flowkit/config/loader_test.go
@@ -173,13 +173,16 @@ func Test_ComposeJSON(t *testing.T) {
 
 	assert.NoError(t, loadErr)
 	assert.Equal(t, 2, len(conf.Accounts))
-	assert.Equal(t, "0x21c5dfdeb0ff03a7a73ef39788563b62c89adea67bbb21ab95e5f710bd1d40b7",
-		conf.Accounts.ByName("emulator-account").Key.PrivateKey.String(),
-	)
-	assert.NotNil(t, conf.Accounts.ByName("admin-account"))
-	assert.Equal(t, "0x3335dfdeb0ff03a7a73ef39788563b62c89adea67bbb21ab95e5f710bd1d40b7",
-		conf.Accounts.ByName("admin-account").Key.PrivateKey.String(),
-	)
+
+	account, err := conf.Accounts.ByName("emulator-account")
+	assert.NoError(t, err)
+
+	adminAccount, err := conf.Accounts.ByName("admin-account")
+	assert.NoError(t, err)
+
+	assert.Equal(t, "0x21c5dfdeb0ff03a7a73ef39788563b62c89adea67bbb21ab95e5f710bd1d40b7", account.Key.PrivateKey.String())
+	assert.NotNil(t, adminAccount)
+	assert.Equal(t, "0x3335dfdeb0ff03a7a73ef39788563b62c89adea67bbb21ab95e5f710bd1d40b7", adminAccount.Key.PrivateKey.String())
 }
 
 func Test_ComposeJSONOverwrite(t *testing.T) {
@@ -214,11 +217,12 @@ func Test_ComposeJSONOverwrite(t *testing.T) {
 	conf, loadErr := composer.Load([]string{"flow.json", "flow-testnet.json"})
 
 	assert.NoError(t, loadErr)
+	account, err := conf.Accounts.ByName("admin-account")
+	assert.NoError(t, err)
+
 	assert.Equal(t, 1, len(conf.Accounts))
-	assert.NotNil(t, conf.Accounts.ByName("admin-account"))
-	assert.Equal(t, "0x3335dfdeb0ff03a7a73ef39788563b62c89adea67bbb21ab95e5f710bd1d40b7",
-		conf.Accounts.ByName("admin-account").Key.PrivateKey.String(),
-	)
+	assert.NotNil(t, account)
+	assert.Equal(t, "0x3335dfdeb0ff03a7a73ef39788563b62c89adea67bbb21ab95e5f710bd1d40b7", account.Key.PrivateKey.String())
 }
 
 func Test_FromFileAccountSimple(t *testing.T) {
@@ -255,9 +259,16 @@ func Test_FromFileAccountSimple(t *testing.T) {
 
 	assert.NoError(t, loadErr)
 	assert.Equal(t, 2, len(conf.Accounts))
-	assert.NotNil(t, conf.Accounts.ByName("admin-account"))
-	assert.Equal(t, conf.Accounts.ByName("admin-account").Address.String(), "f1d6e0586b0a20c7")
-	assert.Equal(t, conf.Accounts.ByName("service-account").Address.String(), "f8d6e0586b0a20c7")
+
+	account, err := conf.Accounts.ByName("admin-account")
+	assert.NoError(t, err)
+
+	serviceAccount, err := conf.Accounts.ByName("service-account")
+	assert.NoError(t, err)
+	assert.NotNil(t, account)
+	assert.Equal(t, account.Address.String(), "f1d6e0586b0a20c7")
+	assert.NotNil(t, serviceAccount)
+	assert.Equal(t, serviceAccount.Address.String(), "f8d6e0586b0a20c7")
 }
 
 func Test_FromFileAccountComplex(t *testing.T) {
@@ -312,17 +323,28 @@ func Test_FromFileAccountComplex(t *testing.T) {
 	composer.AddConfigParser(json.NewParser())
 
 	conf, loadErr := composer.Load([]string{"flow.json"})
-
 	assert.NoError(t, loadErr)
+	serviceAccount, err := conf.Accounts.ByName("service-account")
+	assert.NoError(t, err)
+
+	adminAccount1, err := conf.Accounts.ByName("admin-account-1")
+	assert.NoError(t, err)
+
+	adminAccount3, err := conf.Accounts.ByName("admin-account-3")
+	assert.NoError(t, err)
+
+	adminAccount5, err := conf.Accounts.ByName("admin-account-5")
+	assert.NoError(t, err)
+
 	assert.Equal(t, 4, len(conf.Accounts))
-	assert.NotNil(t, conf.Accounts.ByName("service-account"))
-	assert.NotNil(t, conf.Accounts.ByName("admin-account-1"))
-	assert.NotNil(t, conf.Accounts.ByName("admin-account-3"))
-	assert.NotNil(t, conf.Accounts.ByName("admin-account-5"))
-	assert.Equal(t, conf.Accounts.ByName("service-account").Address.String(), "f8d6e0586b0a20c7")
-	assert.Equal(t, conf.Accounts.ByName("admin-account-1").Address.String(), "f1d6e0586b0a20c7")
-	assert.Equal(t, conf.Accounts.ByName("admin-account-3").Address.String(), "f3d6e0586b0a20c7")
-	assert.Equal(t, conf.Accounts.ByName("admin-account-5").Address.String(), "f5d6e0586b0a20c7")
+	assert.NotNil(t, serviceAccount)
+	assert.NotNil(t, adminAccount1)
+	assert.NotNil(t, adminAccount3)
+	assert.NotNil(t, adminAccount5)
+	assert.Equal(t, serviceAccount.Address.String(), "f8d6e0586b0a20c7")
+	assert.Equal(t, adminAccount1.Address.String(), "f1d6e0586b0a20c7")
+	assert.Equal(t, adminAccount3.Address.String(), "f3d6e0586b0a20c7")
+	assert.Equal(t, adminAccount5.Address.String(), "f5d6e0586b0a20c7")
 }
 
 func Test_JSONEnv(t *testing.T) {
diff --git a/pkg/flowkit/state_test.go b/pkg/flowkit/state_test.go
index ccb1586b..9f2c992f 100644
--- a/pkg/flowkit/state_test.go
+++ b/pkg/flowkit/state_test.go
@@ -326,11 +326,12 @@ func Test_GetContractsByNameSimple(t *testing.T) {
 	p := generateSimpleProject()
 
 	contracts, _ := p.DeploymentContractsByNetwork("emulator")
-
+	account, err := p.conf.Accounts.ByName("emulator-account")
+	assert.NoError(t, err)
 	assert.Len(t, contracts, 1)
 	assert.Equal(t, contracts[0].Name, "NonFungibleToken")
 	assert.Equal(t, contracts[0].Source, "../hungry-kitties/cadence/contracts/NonFungibleToken.cdc")
-	assert.Equal(t, p.conf.Accounts.ByName("emulator-account").Address, contracts[0].Target)
+	assert.Equal(t, account.Address, contracts[0].Target)
 }
 
 func Test_EmulatorConfigSimple(t *testing.T) {
@@ -359,9 +360,10 @@ func Test_AccountByNameSimple(t *testing.T) {
 
 func Test_HostSimple(t *testing.T) {
 	p := generateSimpleProject()
-	host := p.Networks().ByName("emulator").Host
+	network, err := p.Networks().ByName("emulator")
 
-	assert.Equal(t, host, "127.0.0.1.3569")
+	assert.NoError(t, err)
+	assert.Equal(t, network.Host, "127.0.0.1.3569")
 }
 
 func Test_GetContractsByNameComplex(t *testing.T) {
@@ -443,9 +445,11 @@ func Test_AccountByNameComplex(t *testing.T) {
 
 func Test_HostComplex(t *testing.T) {
 	p := generateComplexProject()
-	host := p.Networks().ByName("emulator").Host
+	network, err := p.Networks().ByName("emulator")
+
+	assert.NoError(t, err)
 
-	assert.Equal(t, host, "127.0.0.1.3569")
+	assert.Equal(t, network.Host, "127.0.0.1.3569")
 }
 
 func Test_ContractConflictComplex(t *testing.T) {