

# Troubleshooting AWS Ops Agent for networking

The following sections describe common problems and how to resolve them.

## Where to find the failure reason
<a name="ops-agent-networking-troubleshooting-failure-reason"></a>

When you add, change, or remove AWS Ops Agent for networking, AWS Ops Agent calls the AWS Network Manager network scope operations with your IAM identity. AWS Network Manager reports problems in two places:
+ **When the operation is called.** If a setup step is missing, the operation fails with a `ValidationException` (400) or an `AccessDeniedException` (403), and nothing is created. The exception includes a `ReasonCode` that names the step to fix. The specialist shows **Broken**, and **Status details** shows the error. Fix the step, and then choose **Retry**.
+ **After the operation succeeds.** AWS Network Manager finishes the work in the background. If a later step fails because of your setup, the scope or principal carries a state reason with a `Code` and a `Message`. To view it, run the following commands:

  ```bash
  aws networkmanager get-network-scope --network-scope-id <network-scope-id>
  
  aws networkmanager list-network-scope-principals --network-scope-id <network-scope-id>
  ```

The `Code` tells you what to fix. The `Message` names the specifics, such as the account, Region, role, or denied AWS Organizations action.

A scope or principal shows one reason at a time. After you fix it, the reason clears at the next check (within an hour), and the next problem, if any, appears. Only scopes in the `AVAILABLE` and `FAILED` states carry a reason.

If the cause is on the AWS side, you don't see a reason code. The scope stays `PENDING`, `UPDATING`, or `DELETING` while AWS is alerted and fixes it.

## AWS Ops Agent for networking can't answer a reachability question
<a name="ops-agent-networking-troubleshooting-no-reachability-answer"></a>

AWS Ops Agent for networking can answer only about accounts and Regions that the network scope covers. If it can't answer a reachability question, check the following:
+ **The scope hasn't finished updating.** When an account is added, the scope stays `AVAILABLE` and the principal is `ASSOCIATING` until coverage is built. The scope is `UPDATING` only when the Regions change. Run `get-network-scope` and `list-network-scope-principals`, and wait until the scope is `AVAILABLE` and the principal is `ASSOCIATED`.
+ **The account is missing from the scope.** Run `list-network-scope-principals`. If the source or destination account isn't listed, add the account to AWS Ops Agent for networking.
+ **The Region is missing from the scope.** Run `get-network-scope` and check `NetworkScopeRegions`. If the Region of the source or destination isn't listed, add the Region to AWS Ops Agent for networking.
+ **The account hasn't enabled the Region.** The principal shows `REGION_NOT_ENABLED`, and the `Message` names the Regions. Enable the Region in that account.
+ **The account is only partly covered or isn't covered.** The scope shows `PRINCIPALS_NOT_FULLY_COVERED`. See [A scope reports PRINCIPALS\_NOT\_FULLY\_COVERED](#ops-agent-networking-troubleshooting-not-fully-covered).
+ **The Region isn't supported.** For more information, see [Supported Regions](ops-agent-networking-supported-regions.md).
+ **A resource changed recently.** A resource added or changed in the last 25 minutes might not be in AWS Ops Agent for networking's view yet. Wait a few minutes, and then ask again.
+ **A role was recently deleted.** A deleted role can take up to 6 hours to be removed.

You can also ask AWS Ops Agent for networking which accounts and Regions the scope covers.

## Network security answers don't reflect recent changes
<a name="ops-agent-networking-troubleshooting-stale-security-answers"></a>

Network security analysis runs once every 24 hours. AWS Ops Agent for networking answers network security questions from the most recent analysis, so a change made since that run (for example, to a security group, network ACL, or route table) isn't in the answer yet.

Wait for the next analysis run, up to 24 hours after the change, and then ask again.

## A service-linked role error
<a name="ops-agent-networking-troubleshooting-slr-error"></a>

AWS Ops Agent for networking uses the AWS Network Manager service-linked role (SLR) in the scope owner account and in each covered account.


| When | What you see | Fix | 
| --- | --- | --- | 
| An account is added (AssociateNetworkScopePrincipal) | 400 ValidationException with Fields=[Principal] and ReasonCode NETWORK\_MANAGER\_SERVICE\_LINKED\_ROLE\_NOT\_ASSUMABLE | The AWS Network Manager SLR doesn't exist in that account, or can't be assumed. Create the SLR in the account, and confirm that no SCP blocks it. Then choose Retry. | 
| AWS Ops Agent for networking is added (CreateNetworkScope) | 500 error that names the missing iam:CreateServiceLinkedRole permission | Your IAM identity can't create the AWS Network Manager SLR in the owner account. Grant iam:CreateServiceLinkedRole for networkmanager.amazonaws.com, or create the SLR yourself. Then choose Retry. | 
| Later, on a principal in list-network-scope-principals | FAILED (or ASSOCIATED, if partly covered) with NETWORK\_MANAGER\_SERVICE\_LINKED\_ROLE\_NOT\_ASSUMABLE | The SLR was deleted after the account was added, or the account was suspended. Create the SLR in the account named in the Message. If the account is closed, remove it from AWS Ops Agent for networking. | 

To create the SLR, run the following command in the affected account:

```bash
aws iam create-service-linked-role --aws-service-name networkmanager.amazonaws.com
```

In `ORGANIZATIONS` mode, AWS Network Manager recreates a deleted SLR in member accounts through trusted access. You see this code only for accounts where it can't: the management account and suspended accounts.

## Network security analysis errors
<a name="ops-agent-networking-troubleshooting-nsa-errors"></a>

In `ORGANIZATIONS` mode, AWS Network Manager creates a network security analysis policy in your organization and attaches it to each account in the scope. The following errors mean that the policy can't be created, updated, attached, detached, or deleted.


| Code | Cause | Fix | 
| --- | --- | --- | 
| NETWORK\_SECURITY\_ANALYSIS\_SERVICE\_ACCESS\_NOT\_ENABLED | Trusted access for network security analysis isn't enabled, or was turned off after the scope was created. | Enable trusted access for the service principal named in the Message. | 
| NETWORK\_SECURITY\_ANALYSIS\_POLICY\_TYPE\_NOT\_ENABLED | The network security analysis policy type isn't enabled on the organization root, or was disabled. | Run enable-policy-type on the root for the policy type named in the Message. | 
| NETWORK\_SECURITY\_ANALYSIS\_POLICY\_MANAGEMENT\_NOT\_DELEGATED | The AWS Network Manager delegated administrator doesn't have permission to manage the network security analysis policy. The organization's resource policy is missing, doesn't grant the policy action, or an explicit Deny refuses it. | Update the organization's resource policy to delegate the actions named in the Message. put-resource-policy replaces the whole document, so keep your existing statements. | 
| NETWORK\_SECURITY\_ANALYSIS\_POLICY\_ATTACHMENT\_LIMIT\_EXCEEDED | The account already has the maximum number of directly attached network security analysis policies. | Detach one of the policies from the account, or remove the account from AWS Ops Agent for networking. | 

The resource policy check applies only when the scope owner is a delegated administrator. The management account doesn't need delegation.

Where the error shows up depends on the step that fails:


| Step | What you see | What to do | 
| --- | --- | --- | 
| AWS Ops Agent for networking is added, or an account is added | 400 ValidationException with the code | Fix the cause, and then choose Retry. | 
| The scope is being created, and AWS Organizations denies creating the policy | Scope FAILED with the code | See [A scope is FAILED](#ops-agent-networking-troubleshooting-scope-failed). | 
| The scope is being updated (for example, a Region change) | Scope stays AVAILABLE with the code. Coverage keeps its previous Regions. | Fix the cause. The update applies at the next check. | 
| The policy is being attached to an account | Only that principal is FAILED with the code. Other accounts aren't affected. | Fix the cause. The principal recovers on its own. | 
| The policy is being detached from an account | Principal stays DISASSOCIATING with NETWORK\_SECURITY\_ANALYSIS\_POLICY\_MANAGEMENT\_NOT\_DELEGATED | Grant the action. The removal finishes at the next hourly check. | 
| The scope is being deleted | Scope FAILED with the code | Fix the cause, and then remove AWS Ops Agent for networking again. If the policy is already deleted or isn't attached anywhere, the delete completes. | 

While the scope owner has lost its AWS Network Manager standing (see the next section), no network security analysis code is shown. Fix the owner problem first.

## The scope owner isn't the delegated administrator
<a name="ops-agent-networking-troubleshooting-owner-not-delegated-admin"></a>

In `ORGANIZATIONS` mode, the account that owns the scope must stay in the organization and must be the management account or the AWS Network Manager delegated administrator. A mismatch shows up as one of the following codes.


| Code | Cause | 
| --- | --- | 
| SCOPE\_OWNER\_NOT\_NETWORK\_MANAGER\_DELEGATED\_ADMINISTRATOR | The owner account isn't the management account or a delegated administrator for AWS Network Manager. For example, a different account is registered as the delegated administrator, or the owner was deregistered. | 
| SCOPE\_OWNER\_NOT\_ORGANIZATION\_MEMBER | The owner account isn't in an organization, left the scope's organization, or moved to another organization. When an account is added, this code also means that the owner's current organization isn't the scope's organization. | 
| NETWORK\_MANAGER\_SERVICE\_ACCESS\_NOT\_ENABLED | Trusted access for AWS Network Manager was turned off. | 

Where the mismatch shows up depends on when it happens:
+ **When AWS Ops Agent for networking or an account is added:** 403 `AccessDeniedException` with `SCOPE_OWNER_NOT_NETWORK_MANAGER_DELEGATED_ADMINISTRATOR` or `SCOPE_OWNER_NOT_ORGANIZATION_MEMBER`. Add AWS Ops Agent for networking from the management account or from the account that is registered as the AWS Network Manager delegated administrator. To check which account is registered, run `list-delegated-administrators` from the management account.
+ **After the scope exists:** AWS Network Manager checks the owner every hour and after organization changes. If the owner loses its standing:
  + The scope stays `AVAILABLE` and shows the owner code.
  + Every principal becomes `INACTIVE` with the same code, and AWS Ops Agent for networking stops covering those accounts.
  + After you fix the cause (register the owner as the delegated administrator again, rejoin the organization, or turn trusted access back on), the principals return to `ASSOCIATING` and then `ASSOCIATED` automatically. You don't need to remove and add AWS Ops Agent for networking again.
+ **When AWS Ops Agent for networking is removed:** If the owner left the organization, the first delete ends `FAILED` with `SCOPE_OWNER_NOT_ORGANIZATION_MEMBER`. The `Message` names the leftover network security analysis policy and the old organization's management account. The second delete completes whether or not that policy was removed. Removing the policy is recommended cleanup from the old management account, not something the second delete waits for.

When more than one problem applies, the scope shows them in this order: `SCOPE_OWNER_NOT_ORGANIZATION_MEMBER`, `NETWORK_MANAGER_SERVICE_ACCESS_NOT_ENABLED`, `SCOPE_OWNER_NOT_NETWORK_MANAGER_DELEGATED_ADMINISTRATOR`, the network security analysis codes, and then `PRINCIPALS_NOT_FULLY_COVERED`.

## ValidationException (organization mode)
<a name="ops-agent-networking-troubleshooting-validation"></a>


| Cause | ReasonCode | Fix | 
| --- | --- | --- | 
| AWS Network Manager trusted access isn't enabled. | NETWORK\_MANAGER\_SERVICE\_ACCESS\_NOT\_ENABLED | Enable trusted access for AWS Network Manager. | 
| Network security analysis trusted access isn't enabled. | NETWORK\_SECURITY\_ANALYSIS\_SERVICE\_ACCESS\_NOT\_ENABLED | Enable trusted access for network security analysis. | 
| The network security analysis policy type isn't enabled on the root. | NETWORK\_SECURITY\_ANALYSIS\_POLICY\_TYPE\_NOT\_ENABLED | Run enable-policy-type on the organization root. | 
| The delegation resource policy is missing or doesn't grant the policy actions. | NETWORK\_SECURITY\_ANALYSIS\_POLICY\_MANAGEMENT\_NOT\_DELEGATED | Add or update the AWS Organizations resource policy that delegates the policy actions. | 
| The account isn't an active member of the owner's organization. | NOT\_IN\_OWNER\_ORGANIZATION | Add an account from the owner's organization. | 
| The account is suspended or is the management account. | None (Fields=[Principal]) | Add a different account. | 
| The account's AWS Network Manager SLR doesn't exist or can't be assumed. | NETWORK\_MANAGER\_SERVICE\_LINKED\_ROLE\_NOT\_ASSUMABLE | See [A service-linked role error](#ops-agent-networking-troubleshooting-slr-error). | 

AWS Network Manager runs these checks in order and reports the first missing step. After you fix one step, the retry can report the next one.

## AccessDeniedException (organization mode)
<a name="ops-agent-networking-troubleshooting-accessdenied"></a>

The caller must be the management account or the AWS Network Manager delegated administrator, and must still be in the organization. The exception carries `SCOPE_OWNER_NOT_NETWORK_MANAGER_DELEGATED_ADMINISTRATOR` or `SCOPE_OWNER_NOT_ORGANIZATION_MEMBER`. Check the delegated administrators with `list-delegated-administrators`. For more information, see [The scope owner isn't the delegated administrator](#ops-agent-networking-troubleshooting-owner-not-delegated-admin).

## A scope is FAILED
<a name="ops-agent-networking-troubleshooting-scope-failed"></a>

A scope is `FAILED` only when your setup blocked a create or a delete. A `FAILED` scope doesn't serve AWS Ops Agent for networking, counts against the scope quota, and can only be deleted. Read the state reason with `get-network-scope`, and then do the following:
+ **For a failed create:** Remove AWS Ops Agent for networking (which deletes the scope), fix the cause, and then add AWS Ops Agent for networking again.
+ **For a failed delete:** Fix the cause, and then remove AWS Ops Agent for networking again.

A failed update doesn't make the scope `FAILED`. The scope stays `AVAILABLE` with a reason, and the update applies after you fix the cause.

## A scope reports PRINCIPALS\_NOT\_FULLY\_COVERED
<a name="ops-agent-networking-troubleshooting-not-fully-covered"></a>

One or more accounts are `FAILED`, `INACTIVE`, or only partly covered. Run `list-network-scope-principals`. Each principal carries its own code.


| Code | Cause | Fix | 
| --- | --- | --- | 
| REGION\_NOT\_ENABLED | The account hasn't enabled one or more of the scope's Regions. | Enable the Regions named in the Message. | 
| NETWORK\_MANAGER\_SERVICE\_LINKED\_ROLE\_NOT\_ASSUMABLE | The SLR is missing or can't be assumed (for example, an SCP blocks it). | Create the SLR, or remove the SCP block. | 
| NETWORK\_SECURITY\_ANALYSIS\_POLICY\_MANAGEMENT\_NOT\_DELEGATED | Attaching the network security analysis policy to the account was denied. | Update the organization's resource policy. | 
| NETWORK\_SECURITY\_ANALYSIS\_POLICY\_ATTACHMENT\_LIMIT\_EXCEEDED | The account is at its policy attachment limit. | Detach a policy, or remove the account from AWS Ops Agent for networking. | 
| NOT\_IN\_OWNER\_ORGANIZATION | The account left the owner's organization. | Move the account back, or remove it from AWS Ops Agent for networking. | 
| ORGANIZATIONAL\_UNIT\_DELETED | The OU was deleted. | Remove the OU from AWS Ops Agent for networking, and add its accounts. | 

## A principal is INACTIVE
<a name="ops-agent-networking-troubleshooting-inactive"></a>

The principal is suspended because the owner lost standing, the principal left the organization, or the OU was deleted. The state reason names the cause. A principal returns to `ASSOCIATING` automatically only when the cause was an owner code or `NOT_IN_OWNER_ORGANIZATION`. When the cause is `ORGANIZATIONAL_UNIT_DELETED`, the principal is never restored. Remove the OU from AWS Ops Agent for networking, and add its accounts directly.

## The specialist is Broken
<a name="ops-agent-networking-troubleshooting-broken"></a>

On the **Capabilities** tab, choose **Broken**, and then choose **Status details** to read the reason. Fix the cause, choose **Retry** in **Actions**, review the **Add specialist** dialog box, and then choose **Add specialist**.

## The specialist stays Pending
<a name="ops-agent-networking-troubleshooting-pending"></a>
+ Confirm that the AWS Network Manager service-linked role is present. If it isn't, run `aws iam create-service-linked-role --aws-service-name networkmanager.amazonaws.com`.
+ Confirm that your IAM identity has the network scope permissions. For more information, see [Getting started with AWS Ops Agent for networking](ops-agent-networking-getting-started.md).
+ View the scope state and state reason with `get-network-scope`. For more information, see [Working with network scopes](ops-agent-networking-network-scopes.md). A scope that stays `PENDING` with no reason is delayed on the AWS side, and AWS is alerted.

## Trusted access shows off after you choose Enable
<a name="ops-agent-networking-troubleshooting-trusted-access-off"></a>

AWS Network Manager enables trusted access asynchronously. Wait a minute, and then refresh.

## An OU association stays pending-confirmation
<a name="ops-agent-networking-troubleshooting-ou-pending"></a>

The `statusReason` describes the blocker. Fix it, and then run `update-association` with the same configuration. A status of `invalid` means the target is gone (the OU was deleted, trusted access was turned off, or the delegated administrator was deregistered).

## Some member accounts didn't get the agent role
<a name="ops-agent-networking-troubleshooting-member-roles"></a>

The `deploymentState.issues` field groups accounts by `reasonCode`, such as `managementAccountNotSupported`, `accountSuspended`, and `deploymentFailed`. These issues don't block a `valid` status.

## The AWS Ops Agent for networking association stays pending-confirmation or invalid
<a name="ops-agent-networking-troubleshooting-agent-pending"></a>

Check the `statusReason`. Confirm that the monitor role trust policy names the Agent Space ARN and account, that both managed policies are attached, and that no SCP blocks the agent role or the networking service-linked roles.

## AWS Ops Agent for networking can't use its network tools
<a name="ops-agent-networking-troubleshooting-tool-permissions"></a>

AWS Ops Agent for networking invokes its network tools (for example, `networkmanager:QueryTopology`) using the Agent Space monitor role in the scope owner account, because that account owns the network scope. If these tool calls fail, confirm that the monitor role, not a secondary account's role, has the required permissions. The `AIDevOpsAgentAccessPolicy` managed policy grants these permissions; make sure it is attached to the monitor role.

## Removing AWS Ops Agent for networking fails
<a name="ops-agent-networking-troubleshooting-removal"></a>

AWS Ops Agent couldn't delete the network scope. A common cause is a missing `networkmanager:DeleteNetworkScope` permission. If the owner account left the organization, the first delete ends `FAILED` and names the leftover network security analysis policy. The second delete completes whether or not that policy was removed. Removing the policy is recommended cleanup from the old management account, not something the second delete waits for.