Cannot dot-source this command because it was defined in a different language mode.

Open 💬 3 comments Opened Dec 9, 2025 by doggy8088

What version of Codex is running?

OpenAI Codex v0.66.0 (research preview)

What subscription do you have?

Azure OpenAI Service

Which model were you using?

gpt-5.1-codex-max

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What issue are you seeing?

I see this error:

Microsoft.PowerShell_profile.ps1: Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the '.' operator.

<img width="2300" height="1100" alt="Image" src="https://github.com/user-attachments/assets/33a7c93f-4902-4645-acca-63e22b149586" />

What steps can reproduce the bug?

Open pwsh.exe and run the following commands:

git clone https://github.com/openai/codex --depth=1
cd codex

del NOTICE

codex review --uncommitted
OpenAI Codex v0.66.0 (research preview)
--------
workdir: G:\Projects\codex
model: gpt-5.1-codex-max
provider: azure
approval: never
sandbox: workspace-write [workdir, /tmp, $TMPDIR]
reasoning effort: high
reasoning summaries: detailed
session id: 019b037d-829f-7ab1-8ae2-411f4017e3fc
--------
user
current changes
mcp startup: no servers
mcp startup: no servers

thinking
I'm thinking about needing a repository difference. First, I'll check the status using the shell command for "git status" to see what has changed. Then, I can show the actual differences in the files. That's essential for understanding what modifications have been made. I'll want to make sure I capture all relevant information to keep track of the changes effectively. Let's make sure to follow these steps clearly to maintain organization!
thinking
I'm thinking about needing a repository difference. First, I'll check the status using the shell command for "git status" to see what has changed. Then, I can show the actual differences in the files. That's essential for understanding what modifications have been made. I'll want to make sure I capture all relevant information to keep track of the changes effectively. Let's make sure to follow these steps clearly to maintain organization!
exec
"C:\\Program Files\\PowerShell\\7\\pwsh.exe" -Command "cd G:\\Projects\\codex && git status --short" in G:\Projects\codex succeeded in 1.80s:
 D NOTICE
Microsoft.PowerShell_profile.ps1: Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the '.' operator.

thinking
**Evaluating git status**

Alright, I'm looking at the `git status` command, and it only shows "D NOTICE"? That doesn't seem quite right, and now I'm seeing an error message. I definitely need to run `git diff` to check what changes are going on with my files. It seems like there's more to uncover here, so let me take a closer look at the changes that might be creating this issue. Let's get to the bottom of it!
thinking
**Evaluating git status**

Alright, I'm looking at the `git status` command, and it only shows "D NOTICE"? That doesn't seem quite right, and now I'm seeing an error message. I definitely need to run `git diff` to check what changes are going on with my files. It seems like there's more to uncover here, so let me take a closer look at the changes that might be creating this issue. Let's get to the bottom of it!
exec
"C:\\Program Files\\PowerShell\\7\\pwsh.exe" -Command "cd G:\\Projects\\codex && git diff --stat" in G:\Projects\codex succeeded in 1.73s:
 NOTICE | 6 ------
 1 file changed, 6 deletions(-)
Microsoft.PowerShell_profile.ps1: Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the '.' operator.
exec
"C:\\Program Files\\PowerShell\\7\\pwsh.exe" -Command "cd G:\\Projects\\codex && git diff" in G:\Projects\codex succeeded in 1.68s:
diff --git a/NOTICE b/NOTICE
deleted file mode 100644
index 2805899..0000000
--- a/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-OpenAI Codex
-Copyright 2025 OpenAI
-
-This project includes code derived from [Ratatui](https://github.com/ratatui/ratatui), licensed under the MIT license.
-Copyright (c) 2016-2022 Florian Dehau
-Copyright (c) 2023-2025 The Ratatui Developers
Microsoft.PowerShell_profile.ps1: Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the '.' operator.



thinking
**Evaluating NOTICE file removal**

I'm considering the implications of deleting the NOTICE file. If it's removed, there may be compliance issues, especially regarding licensing. I should check if this removal was intentional and how it aligns with project guidelines. Removing it could violate the MIT license and create a lack of attribution, which likely isn't desired. I need to assess whether this deletion needs flagging as a bug, particularly if it impacts compliance. It's critical to be cautious about assumptions here.
thinking
**Flagging compliance issue**

I'm considering the implications of removing the NOTICE file, especially regarding attribution for derived code. If this code is linked to Ratatui, its removal could breach license obligations, which feels like a big deal. I think it’s worth flagging this as a potential bug. I need to specify the code's location and provide a title with a priority tag, like "[P1] Removing NOTICE breaks third-party attribution." The removal risks non-compliance with the MIT license, so I need to state that the patch appears incorrect. My confidence in this assessment is moderate.
thinking
**Preparing JSON output**

I need to check my instructions on specifying the minimal line range. Since the file is deleted, I'll provide the line range as start1 to end6. The output needs to be in JSON format without markdown fences. I’ll create a findings array with just one entry, along with an overall explanation and an overall confidence score. It's important that I follow the exact format to ensure clarity and accuracy in the output. Let's get this done!
thinking
**Evaluating NOTICE file removal**

I'm considering the implications of deleting the NOTICE file. If it's removed, there may be compliance issues, especially regarding licensing. I should check if this removal was intentional and how it aligns with project guidelines. Removing it could violate the MIT license and create a lack of attribution, which likely isn't desired. I need to assess whether this deletion needs flagging as a bug, particularly if it impacts compliance. It's critical to be cautious about assumptions here.
thinking
**Flagging compliance issue**

I'm considering the implications of removing the NOTICE file, especially regarding attribution for derived code. If this code is linked to Ratatui, its removal could breach license obligations, which feels like a big deal. I think it’s worth flagging this as a potential bug. I need to specify the code's location and provide a title with a priority tag, like "[P1] Removing NOTICE breaks third-party attribution." The removal risks non-compliance with the MIT license, so I need to state that the patch appears incorrect. My confidence in this assessment is moderate.
thinking
**Preparing JSON output**

I need to check my instructions on specifying the minimal line range. Since the file is deleted, I'll provide the line range as start1 to end6. The output needs to be in JSON format without markdown fences. I’ll create a findings array with just one entry, along with an overall explanation and an overall confidence score. It's important that I follow the exact format to ensure clarity and accuracy in the output. Let's get this done!
codex
The patch removes the NOTICE file containing third‑party license attribution, which appears required if Ratatui-derived code remains; this introduces a compliance issue.

Review comment:

- [P1] Removing NOTICE drops required third‑party attribution — G:\Projects\codex\NOTICE:1-6
  Deleting `NOTICE` removes the attribution to Ratatui (MIT) that the project previously claimed to incorporate. If the codebase still includes Ratatui-derived code, the MIT license requires preservation of the copyright notice, so this change introduces a compliance risk rather than just a docs cleanup.
tokens used
5,492

What is the expected behavior?

My Microsoft.PowerShell_profile.ps1 file is actually EMPTY. I do have that file, but I remove everything but only keep required environment variable. I expected no error shown during run Codex CLI.

Additional information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗