Answers.Body: <p>I don't know if this counts as an answer so much as a workaround but I was getting the same error message when I was manually typing in the layer name. There was no typo; the layer definitely existed. It was maddening. </p>
  
  <p>But when I used the pickwhip to link it to the layer, After Effects would automatically generate the 'thisComp.layer("Layer Name Here")' code. Then I just built the rest of my expression around that line. That seemed to work fine. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-25T20:15:13.577Z
Answers.LastActivityDate: 2018-04-25T20:15:13.577Z
Answers.UserDisplayName: noLongerRandom
Body: <p>I'm using a plugin called Duik 15 to rig a character to turn the right arm into an IK controller, and it has produced an expression that is unable to find one of my layers.</p>
  
  <p>I'm not sure why it's not able to see it, but I'm wondering if anyone has encountered the issue before within their expressions?</p>
  
  <p>Here's the expression that Duik generated, with the problem being on line 2.</p>
  
  <pre><code>//Duik.twoLayerIK
  layer1 = thisComp.layer('M R Bicep'); // Not finding me
  layer2 = thisComp.layer('M R Forarm');
  controller = thisComp.layer('C_M R Hand');
  endPos = layer2.effect('IK End')(1);
  ctrlEffect = controller.effect("IK M R Forarm");
  limit = effect('IK Limit')(1);
  FK = ctrlEffect(4);
  IKFK = ctrlEffect(3) == 0;
  cw = ctrlEffect(1) == 1;
  function getWorldPos(L) {
      return L.toWorld(L.anchorPoint);
  }
  function ik() {
      A = getWorldPos(layer1);
      B = getWorldPos(layer2);
      C = layer2.toWorld(endPos);
      E = getWorldPos(controller);
      a = length(B,C);
      b = length(E,A);
      c = length(A,B);
      x = (b*b + c*c - a*a )/(2*b);
      alpha = Math.acos(clamp(x/c,-1,1));
      D = E - A;
      delta = Math.atan2(D[1],D[0]);
      result = radiansToDegrees(delta - (cw ? 1 : -1)*alpha);
      V = B - A;
      adj1 = radiansToDegrees(Math.atan2(V[1],V[0]));
      IK = result - adj1 + value;
      if (IK &lt; limit) IK+=360;
      return IK;
  }
  IKFK ? ik() : FK;
  </code></pre>
  
  <p>And also a screenshot of some of my layers, with the offending code situated inside M R Bicep's rotation expression.</p>
  
  <p><a href="https://i.sstatic.net/bFQMc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bFQMc.png" alt="My layers"></a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-24T12:18:53.933Z
Comments.Text: This is on a mac right? Has it only just started hapening? I've been having trouble with layer names in expressions on a mac with the most recent version of AE, specifically with the DUIK scripts. For some reason the layer names end up with invisible line returns in them. It's made DUIK almost unusuable on the mac.
Comments.UserDisplayName: stib
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-04-12T22:33:02.330Z
Comments.Text: I can confirm this is still happening on Mac, latest version of AE :(
Comments.UserDisplayName: Parker Young
Tags: <after-effects><after-effects-expressions>
Title: After Effects Expression, layer not found or missing
UserDisplayName: Sean Proctor
ThreadText: # After Effects Expression, layer not found or missing
  
  (Asked by: username_0 on 2016-10-24)
  
  I'm using a plugin called Duik 15 to rig a character to turn the right arm into an IK controller, and it has produced an expression that is unable to find one of my layers.
  
  I'm not sure why it's not able to see it, but I'm wondering if anyone has encountered the issue before within their expressions?
  
  Here's the expression that Duik generated, with the problem being on line 2.
  
  ```
  //Duik.twoLayerIK
  layer1 = thisComp.layer('M R Bicep'); // Not finding me
  layer2 = thisComp.layer('M R Forarm');
  controller = thisComp.layer('C_M R Hand');
  endPos = layer2.effect('IK End')(1);
  ctrlEffect = controller.effect("IK M R Forarm");
  limit = effect('IK Limit')(1);
  FK = ctrlEffect(4);
  IKFK = ctrlEffect(3) == 0;
  cw = ctrlEffect(1) == 1;
  function getWorldPos(L) {
      return L.toWorld(L.anchorPoint);
  }
  function ik() {
      A = getWorldPos(layer1);
      B = getWorldPos(layer2);
      C = layer2.toWorld(endPos);
      E = getWorldPos(controller);
      a = length(B,C);
      b = length(E,A);
      c = length(A,B);
      x = (b*b + c*c - a*a )/(2*b);
      alpha = Math.acos(clamp(x/c,-1,1));
      D = E - A;
      delta = Math.atan2(D[1],D[0]);
      result = radiansToDegrees(delta - (cw ? 1 : -1)*alpha);
      V = B - A;
      adj1 = radiansToDegrees(Math.atan2(V[1],V[0]));
      IK = result - adj1 + value;
      if (IK < limit) IK+=360;
      return IK;
  }
  IKFK ? ik() : FK;
  
  ```
  
  And also a screenshot of some of my layers, with the offending code situated inside M R Bicep's rotation expression.
  
  [![My layers](https://i.sstatic.net/bFQMc.png)](https://i.sstatic.net/bFQMc.png)
  
  **Tags:** after-effects, after-effects-expressions
  
  > **Comments:**
  > **username_1**: This is on a mac right? Has it only just started hapening? I've been having trouble with layer names in expressions on a mac with the most recent version of AE, specifically with the DUIK scripts. For some reason the layer names end up with invisible line returns in them. It's made DUIK almost unusuable on the mac.  
  > **username_2**: I can confirm this is still happening on Mac, latest version of AE :(  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2018-04-25. Score: 0
  
  I don't know if this counts as an answer so much as a workaround but I was getting the same error message when I was manually typing in the layer name. There was no typo; the layer definitely existed. It was maddening.
  
  But when I used the pickwhip to link it to the layer, After Effects would automatically generate the 'thisComp.layer("Layer Name Here")' code. Then I just built the rest of my expression around that line. That seemed to work fine.
  
  
  ---
  
  