CocoaPods/CocoaPods · error · Pod::Informative
An error occurred while processing the pre-integrate hook of
Error message
An error occurred while processing the pre-integrate hook of the Podfile.
#{e.message}
#{e.backtrace * "\n"} What it means
Installer#run_podfile_pre_integrate_hook invokes the Podfile's `pre_integrate do |installer| ... end` block (runs before the Pods project is generated) and rescues any exception, re-raising as Informative with the original message and full backtrace appended. The hook name in the header is the only difference from the other hook wrappers; diagnosis is identical.
Source
Thrown at lib/cocoapods/installer.rb:987
# @return [void]
#
def run_podfile_pre_integrate_hooks
UI.message '- Running pre integrate hooks' do
executed = run_podfile_pre_integrate_hook
UI.message '- Podfile' if executed
end
end
# Runs the pre integrate hook of the Podfile.
#
# @raise Raises an informative if the hooks raises.
#
# @return [Boolean] Whether the hook was run.
#
def run_podfile_pre_integrate_hook
podfile.pre_integrate!(self)
rescue => e
raise Informative, 'An error occurred while processing the pre-integrate ' \
'hook of the Podfile.' \
"\n\n#{e.message}\n\n#{e.backtrace * "\n"}"
end
# Runs the post install hooks of the installed specs and of the Podfile.
#
# @note Post install hooks run _before_ saving of project, so that they
# can alter it before it is written to the disk.
#
# @return [void]
#
def run_podfile_post_install_hooks
UI.message '- Running post install hooks' do
executed = run_podfile_post_install_hook
UI.message '- Podfile' if executed
end
end
View on GitHub (pinned to b80e113e28)
Solutions
- Locate the failing line via the embedded backtrace frame inside the Podfile and fix the Ruby error.
- At pre-integrate time, prefer analyzer results (`installer.analysis_result`) over project objects that may not exist yet.
- Comment the block out to confirm the install proceeds, then restore incrementally.
- Pin the CocoaPods version your hooks were written against (Gemfile + `bundle exec pod install`) until the hook is ported.
Example fix
# before (Podfile) pre_integrate do |installer| puts installer.aggregate_targets.map(&:name).upcase # NoMethodError: Array has no upcase end # after pre_integrate do |installer| puts installer.aggregate_targets.map(&:name).map(&:upcase).inspect end
Defensive patterns
Strategy: try-catch
Validate before calling
# Syntax-check the Podfile before CI install
system('ruby -c Podfile') or abort 'Podfile has a Ruby syntax error' Try / catch
pre_integrate do |installer|
begin
# ... hook logic ...
rescue NoMethodError => e
Pod::UI.warn "pre_integrate: API misuse #{e.message} — check CocoaPods #{Pod::VERSION}"
raise
end
end Prevention
- At pre-integrate time, rely on `installer.analysis_result` rather than assuming the Pods project is fully materialized.
- Write hooks defensively: check collections are non-empty before mapping.
- Version-pin CocoaPods on CI and locally so hook behavior is reproducible.
When it happens
Trigger: Any exception raised by Ruby inside `pre_integrate do |installer| ... end`: nil dereferences on installer state that is not yet populated at pre-integrate time, undefined methods, or version-drifted CocoaPods APIs.
Common situations: Hooks assuming pods_project/targets exist before project generation; hooks written for older CocoaPods after an upgrade; shared Podfile templates where the hook expects targets a project doesn't have.
Related errors
- An error occurred while processing the pre-install hook of t
- An error occurred while processing the post-install hook of
- An error occurred while processing the post-integrate hook o
- No `Podfile' found in the project directory.
- Existing Podfile found in directory
AI-assisted analysis of CocoaPods/CocoaPods@b80e113e28 (2026-08-21).
Data as JSON: /api/errors/1d2d1a0cea12cbd1.
Report an issue: GitHub.