Problem with finding an objects netId clientside

Hello guys,
I’ve been dealing with a problem for two days now and I’ve tried countless solutions to no avail so
any help would be greatly apreciated. First I will explain how the system is supposed to work.
On start the EnvManager object (on server) spawns all containers (crates) on the network and fills them with their contents. Here is the chest prefab in the inspector.101612-crate.png

And here is the code that spawns them.

void Start () {
		if (!isServer) {
			return;
		}
		for (int i = 0; i < this.GetComponent<EnvDatabase>().containers0.Length; i++) {
			ContInit (i);
		}
	}

	public void ContInit (int contID) {
		if (!this.GetComponent<EnvDatabase>().containers0init [contID]) {
			Debug.Log ("Container " + contID + " initializing");
			string items = this.GetComponent<EnvDatabase> ().containers0 [contID];
			GameObject clone;
			clone = Instantiate(contP, this.GetComponent<EnvDatabase> ().containers0go [contID].transform.position, this.GetComponent<EnvDatabase> ().containers0go [contID].transform.rotation) as GameObject;
			for (int i = 1; i < count(items, '×'); i++) {
				(clone.GetComponent ("container") as container).items.Add (decode(i, items, '×'));
			}
			NetworkServer.Spawn(clone);
			this.GetComponent<EnvDatabase> ().containers0init [contID] = true;
		}
	}

As far as I can tell this code works perfectly however I could be wrong.

Here is the code for interacting with the crate.

RaycastHit hit;
		if (Physics.Raycast (mainCam.transform.position, mainCam.transform.TransformDirection (Vector3.forward), out hit, 4.0f)) {
			if (hit.transform.tag == "dItem") {
				dItem dItemS = hit.collider.GetComponent<dItem> ();
				rayItem = dItemS.iCode;
				if (Input.GetKeyDown ("f")) {
					addItem (rayItem);
					CmdDestroyI (hit.collider.GetComponent<NetworkIdentity> ().netId);
					nGUIScript.notifications.Add ("Picked up item : " + decode (4, rayItem, '>'));
				}
			} else if (hit.transform.tag == "container") {
				if (Input.GetKeyDown ("f")) {
					contID = hit.collider.GetComponent<NetworkIdentity> ().netId;
					Debug.Log ("Container : " + NetworkServer.FindLocalObject(contID).name);
					nGUIScript.menuON [0] = true;
					nGUIScript.swS = 2;
				}
			} else {
				rayItem = "";
			}
		}

The most important code is under “else if (hit.transform.tag == “container”)”.
As a host I can walk up to the crate and interact with it using “f”.
The log outputs “Container : crate(Clone)” as expected.
But when I try to do the same thing as client I get an error -
“NullReferenceException: Object reference not set to an instance of an object
nSubprograms.Update () (at Assets/Scripts/Player/nSubprograms.cs:113)”
I assume this means contID was not set to netId but I have no idea why this is or how to fix it.
Any help is welcome.

You should use ClientScene.FindLocalObject on a client

https://docs.unity3d.com/ScriptReference/Networking.ClientScene.FindLocalObject.html